There was an error while loading. Please reload this page.
Migrations are a key point of your application. With that in mind we've created a way to run a migration cross platform.
To create a table
Migration[MigrationStep.Migrate] = (database, dbProvider) => { var studentTable = database.AddTable("Students"); }
To add fields
studentTable.AddColumn( "Id", typeof( Guid ) ).PrimaryKey().NotNullable(); studentTable.AddColumn( "FirstName", typeof( string ), 100 );
And that's it!
Here's a complete example of how to create a Migration
public class Migration001 : AppCoreMigration { public Migration001():base(1) { Migration[MigrationStep.Migrate] = (database, dbProvider) => { var gooseTable = database.AddTable("Geese"); gooseTable.AddColumn("Id", typeof(Guid)).PrimaryKey().NotNullable(); gooseTable.AddColumn("Name", typeof(string), 100).Nullable(); gooseTable.AddColumn("BirthDate", typeof (DateTime)).Nullable(); gooseTable.AddColumn("IsDead", typeof (bool)).NotNullable(false); database.AddIndex("Geese", "BirthDate"); }; } }