public Configuration() { AutomaticMigrationsEnabled = true; //AutomaticMigrationDataLossAllowed = true; SetSqlGenerator("MySql.Data.MySqlClient", new MySqlMigrationSqlGenerator()); CodeGenerator = new MySqlMigrationCodeGenerator(); }
public void CanGenerateAddColumnForGeometryType() { var migration = new MySqlMigrationCodeGenerator().Generate("MigrationCodeGenerationTest", new [] { new AddColumnOperation("TestTable", new ColumnModel(PrimitiveTypeKind.Geometry) { Name = "MyGeometryColumn" }) }, "SourceModel", "TargetModel", "MyTestNamespace", "MyClass"); Assert.AreEqual(@"namespace MyTestNamespace { using System; using System.Data.Entity.Migrations; using System.Data.Spatial; public partial class MyClass : DbMigration { public override void Up() { AddColumn(""TestTable"", ""MyGeometryColumn"", c => c.Geometry()); } public override void Down() { DropColumn(""TestTable"", ""MyGeometryColumn""); } } } ", migration.UserCode); }
public Configuration() { AutomaticMigrationsEnabled = false; SetSqlGenerator("MySql.Data.MySqlClient", new MySqlMigrationSqlGenerator()); SetHistoryContextFactory("MySql.Data.MySqlClient", (conn, schema) => new MySqlHistoryContext(conn, schema)); CodeGenerator = new MySqlMigrationCodeGenerator(); }
public Configuration() { CodeGenerator = new MySqlMigrationCodeGenerator(); AutomaticMigrationsEnabled = false; TargetDatabase = new DbConnectionInfo(DbSettings.Deserialize().GetConnectionString(), "MySql.Data.MySqlClient"); SetSqlGenerator("MySql.Data.MySqlClient", new MySqlMigrationSqlGenerator()); }
public void CanGenerateForeignKeyCode() { var fkOperation = new AddForeignKeyOperation(); fkOperation.Name = "MyForeignKeyTest"; fkOperation.PrincipalTable = "PrincipalTableTest"; fkOperation.DependentTable = "DependentTableTest"; fkOperation.PrincipalColumns.Add("IdColumn"); fkOperation.DependentColumns.Add("IdDependentColumn"); fkOperation.CascadeDelete = true; var migration = new MySqlMigrationCodeGenerator().Generate("MigrationCodeGenerationTest", new [] { fkOperation }, "SourceModel", "TargetModel", "MyTestNamespace", "MyClass"); Assert.AreEqual(@"namespace MyTestNamespace { using System; using System.Data.Entity.Migrations; public partial class MyClass : DbMigration { public override void Up() { AddForeignKey(""DependentTableTest"", ""IdDependentColumn"", ""PrincipalTableTest"", ""IdColumn"", cascadeDelete: true, name: ""MyForeignKeyTest""); } public override void Down() { DropForeignKey(""DependentTableTest"", ""MyForeignKeyTest""); } } } ", migration.UserCode); }
public Configuration() { CodeGenerator = new MySqlMigrationCodeGenerator(); AutomaticMigrationsEnabled = false; SetSqlGenerator("MySql.Data.MySqlClient", new MySqlMigrationSqlGenerator()); MigrationsDirectory = @"Migrations\Pf"; }
public void CanGenerateAddColumnForGeometryType() { var migration = new MySqlMigrationCodeGenerator().Generate("MigrationCodeGenerationTest", new [] { new AddColumnOperation("TestTable", new ColumnModel(PrimitiveTypeKind.Geometry){ Name = "MyGeometryColumn" }) }, "SourceModel", "TargetModel","MyTestNamespace", "MyClass"); Assert.AreEqual(@"namespace MyTestNamespace { using System; using System.Data.Entity.Migrations; using System.Data.Spatial; public partial class MyClass : DbMigration { public override void Up() { AddColumn(""TestTable"", ""MyGeometryColumn"", c => c.Geometry()); } public override void Down() { DropColumn(""TestTable"", ""MyGeometryColumn""); } } } ", migration.UserCode); }
public JourneyConfiguration() { CodeGenerator = new MySqlMigrationCodeGenerator(); AutomaticMigrationsEnabled = true; SetSqlGenerator("MySql.Data.MySqlClient", new MySql.Data.Entity.MySqlMigrationSqlGenerator()); SetHistoryContextFactory("MySql.Data.MySqlClient", (existingConnection, defaultSchema) => new MyHistoryContext(existingConnection, defaultSchema)); }
public Configuration() { AutomaticMigrationsEnabled = false; // ãªéÊÓËÃѺ mysql code generator SetSqlGenerator("MySql.Data.MySqlClient", new MySqlMigrationSqlGenerator()); CodeGenerator = new MySqlMigrationCodeGenerator(); }
//<Ractor.DataContext> public MySqlMigrationsConfiguration() { this.AutomaticMigrationsEnabled = true; this.AutomaticMigrationDataLossAllowed = true; // NB!!! set to false on live data SetSqlGenerator("MySql.Data.MySqlClient", new MySqlMigrationSqlGenerator()); // This will add our MySQLClient as SQL Generator CodeGenerator = new MySqlMigrationCodeGenerator(); }
public Configuration() { //Add-Migration FKNotes; AutomaticMigrationsEnabled = true; SetSqlGenerator("MySql.Data.MySqlClient", new MySqlMigrationSqlGenerator()); CodeGenerator = new MySqlMigrationCodeGenerator(); AutomaticMigrationDataLossAllowed = true; // or false in case data loss is not allowed. }
public MySqlConfiguration() { AutomaticMigrationsEnabled = true; AutomaticMigrationDataLossAllowed = true; SetSqlGenerator("MySql.Data.MySqlClient", new IgnoreDboSqlGenerator()); SetHistoryContextFactory("MySql.Data.MySqlClient", (conn, schema) => new MySqlHistoryContext(conn, "")); CodeGenerator = new MySqlMigrationCodeGenerator(); }
public void CanGenerateCreateTableCode() { var createTable = new CreateTableOperation("TestTable"); var columns = new ColumnModel[3]; columns[0] = new ColumnModel(PrimitiveTypeKind.Int32) { Name = "IdColumn", IsIdentity = true }; columns[1] = new ColumnModel(PrimitiveTypeKind.String) { Name = "StringColumn", IsNullable = false }; columns[2] = new ColumnModel(PrimitiveTypeKind.Decimal) { Name = "DecimalColumn", Precision = 5, Scale = 2 }; createTable.Columns.Add(columns[0]); createTable.Columns.Add(columns[1]); createTable.Columns.Add(columns[2]); createTable.PrimaryKey = new AddPrimaryKeyOperation { Name = "PKTestTable" }; createTable.PrimaryKey.Columns.Add("IdColumn"); var migration = new MySqlMigrationCodeGenerator().Generate("MigrationCodeGenerationTest", new [] { createTable }, "SourceModel", "TargetModel", "MyTestNamespace", "MyClass"); Assert.AreEqual(@"namespace MyTestNamespace { using System; using System.Data.Entity.Migrations; public partial class MyClass : DbMigration { public override void Up() { CreateTable( ""TestTable"", c => new { IdColumn = c.Int(identity: true), StringColumn = c.String(nullable: false), DecimalColumn = c.Decimal(precision: 5, scale: 2), }) .PrimaryKey(t => t.IdColumn, name: ""PKTestTable""); } public override void Down() { DropTable(""TestTable""); } } } ", migration.UserCode); }
public Configuration() { AutomaticMigrationsEnabled = false; DbConfiguration.SetConfiguration(new MySqlEFConfiguration()); CodeGenerator = new MySqlMigrationCodeGenerator(); SetSqlGenerator("MySql.Data.MySqlClient", new MySqlMigrationSqlGenerator()); SetHistoryContextFactory(MySqlProviderInvariantName.ProviderName, (connection, schema) => new MySqlHistoryContext(connection, schema)); }
public EF6Configuration() { CodeGenerator = new MySqlMigrationCodeGenerator(); AutomaticMigrationsEnabled = true; SetSqlGenerator("MySql.Data.MySqlClient", new MySql.Data.EntityFramework.MySqlMigrationSqlGenerator()); }
public Configuration() { AutomaticMigrationsEnabled = false; CodeGenerator = new MySqlMigrationCodeGenerator(); SetSqlGenerator("MySql.Data.MySqlClient", new MySql.Data.Entity.MySqlMigrationSqlGenerator()); }
public void CanGenerateCreateTableCode() { var createTable = new CreateTableOperation("TestTable"); var columns = new ColumnModel[3]; columns[0] = new ColumnModel(PrimitiveTypeKind.Int32) { Name = "IdColumn", IsIdentity = true }; columns[1] = new ColumnModel(PrimitiveTypeKind.String) { Name = "StringColumn", IsNullable = false}; columns[2] = new ColumnModel(PrimitiveTypeKind.Decimal) { Name = "DecimalColumn", Precision = 5, Scale = 2 }; createTable.Columns.Add(columns[0]); createTable.Columns.Add(columns[1]); createTable.Columns.Add(columns[2]); createTable.PrimaryKey = new AddPrimaryKeyOperation { Name = "PKTestTable" }; createTable.PrimaryKey.Columns.Add("IdColumn"); var migration = new MySqlMigrationCodeGenerator().Generate("MigrationCodeGenerationTest", new [] {createTable}, "SourceModel", "TargetModel", "MyTestNamespace", "MyClass"); Assert.AreEqual(@"namespace MyTestNamespace { using System; using System.Data.Entity.Migrations; public partial class MyClass : DbMigration { public override void Up() { CreateTable( ""TestTable"", c => new { IdColumn = c.Int(identity: true), StringColumn = c.String(nullable: false), DecimalColumn = c.Decimal(precision: 5, scale: 2), }) .PrimaryKey(t => t.IdColumn, name: ""PKTestTable""); } public override void Down() { DropTable(""TestTable""); } } } ", migration.UserCode); }
public void CanGenerateForeignKeyCode() { var fkOperation = new AddForeignKeyOperation(); fkOperation.Name = "MyForeignKeyTest"; fkOperation.PrincipalTable = "PrincipalTableTest"; fkOperation.DependentTable = "DependentTableTest"; fkOperation.PrincipalColumns.Add("IdColumn"); fkOperation.DependentColumns.Add("IdDependentColumn"); fkOperation.CascadeDelete = true; var migration = new MySqlMigrationCodeGenerator().Generate("MigrationCodeGenerationTest", new [] {fkOperation}, "SourceModel", "TargetModel", "MyTestNamespace", "MyClass"); Assert.AreEqual(@"namespace MyTestNamespace { using System; using System.Data.Entity.Migrations; public partial class MyClass : DbMigration { public override void Up() { AddForeignKey(""DependentTableTest"", ""IdDependentColumn"", ""PrincipalTableTest"", ""IdColumn"", cascadeDelete: true, name: ""MyForeignKeyTest""); } public override void Down() { DropForeignKey(""DependentTableTest"", ""MyForeignKeyTest""); } } } ", migration.UserCode); }
public Configuration() { AutomaticMigrationsEnabled = false; CodeGenerator = new MySqlMigrationCodeGenerator(); }