Migrating from other databases, namely Access
This article will show you how to migrate a given Access Database to zetbox.
Setting up the Migration Project
The Project Wizard has created a project and all it's configuration. These settings/checks should be made:
zbPublishAll.cmd: Enable export of schema migration
rem export SchemaMigration projects
Zetbox.Cli.exe %config% -export ..\..\Data\SchemaMigrationProject.xml -schemamodules SchemaMigration
IF ERRORLEVEL 1 GOTO FAIL
zbDeployAll.cmd: Enable import of schema migration
Zetbox.Cli.exe %config% -import ..\..\Data\SchemaMigrationProject.xml
IF ERRORLEVEL 1 GOTO FAIL
Migration configuration xml: Check SQL settings
<Server StartServer="true">
<ConnectionStrings>
<Database Name="zetbox" Schema="POSTGRESQL" Provider="NHibernate.Dialect.PostgreSQL82Dialect">Server=localhost;Port=5432;Database=myproject;User Id=zbox</Database>
<Database Name="MyProjectMigration_dest" Schema="POSTGRESQL" Provider="">Server=localhost;Port=5432;Database=myproject_staging;User Id=zbox;</Database>
<Database Name="MyProjectMigration_src" Schema="OLEDB" Provider="">Provider=Microsoft.Jet.OLEDB.4.0;Data Source=.\MyProject.mdb</Database>
</ConnectionStrings>
Setting up Schema Migration
Open zetbox and go to the SchemaMigration module. Create a SchemaMigrationProject.
In the migration project, create a statging database. Your origin data will be copied to this staging database first. The migration process will use the stating database as a source.
- ConnectionStringKey for Destination is the key in your config file for the Staging Database. Remember: The process will copy your origin data to the staging database first, so this is the destination for now.
- Schema in Destination is the schema in your staging database where your source should be copied. This is usefull when there is more than one origin source. The staging database remains the same, but the destination schema will change.
- ConnectionStringKey for Source is the key in your config file for your origin data.
Two Guids has to be fixed in the migration project. These are the export guids of the migration project and the staging database.
Now the migration process can be started to fill the staging database
cd bin\debug
MyProject.Migrate.exe --reloadstaging