This Project includes most of the changes from all forks on GitHub!
But has also a few changes:
- SQLite support is better (Schema Reading, multiple Primary Keys, and much more)
- Remove direct References to the Dataproviders
- Dump Indexes from SQLServer
- Different Migration Scopes in one Database
https://www.nuget.org/packages/DotNetProjects.Migrator/
This project is a fork of "ye olde trusty" Migrator.Net - the original project can be found here on google code, and has since moved to github
M_001_InitialSchema.cs
[Migration(1)]publicclassM_001_InitialSchema:Migration{publicoverridevoidUp(){Database.AddTable("Users",newColumn("Id",DbType.Guid,ColumnProperty.NotNull|ColumnProperty.PrimaryKey),newColumn("CreationDate",DbType.DateTime,ColumnProperty.NotNull),newColumn("ModificationDate",DbType.DateTime,ColumnProperty.NotNull),newColumn("Name",DbType.String,255),newColumn("Password",DbType.String,255),newColumn("ExplicitRoles",DbType.String,int.MaxValue));}publicoverridevoidDown(){}}Code to Apply Migration:
using(varp=ProviderFactory.Create(ProviderTypes.SQLite,connection,null)){varmigrator=newMigrator(p,typeof(M_001_InitialSchema).Assembly,false));if(migrator.LastAppliedMigrationVersion!=null&&migrator.LastAppliedMigrationVersion.Value>migrator.AssemblyLastMigrationVersion){thrownewException("Database has newer Migrations applied then the Software supports");}else{migrator.MigrateToLastVersion();}}In this fork the main changes are:
- Now targets .Net Framework 4.0 instead of 2.0/3.5.
- NetStandart 2.0 will be supported when released
- Support for reserved words.
- Support for guid types across all databases.
- Utility classes for removing all tables etc. from a database (to support migration integration tests).
- Warnings in Oracle when attempting to create column/table/key names that are over-length.
- Removed reliance on deprecated SqlServer views such as Sysconstraints (to support Azure Sql Server deployment).