public override void Up() { Action <ICreateTableWithColumnSyntax> addCols = expr => expr .WithColumn("OperationType").AsInt16().NotNullable() .WithColumn("ChangingUserId").AsInt32().Nullable() .WithColumn("ValidFrom").AsDateTime().NotNullable() .WithColumn("ValidUntil").AsDateTime().NotNullable() .WithColumn("ProductID").AsInt32().NotNullable() .WithColumn("ProductName").AsString(40).Nullable() .WithColumn("ProductImage").AsString(100).Nullable() .WithColumn("Discontinued").AsBoolean().Nullable() .WithColumn("SupplierID").AsInt32().Nullable() .WithColumn("CategoryID").AsInt32().Nullable() .WithColumn("QuantityPerUnit").AsString(20).Nullable() .WithColumn("UnitPrice").AsCurrency().Nullable() .WithColumn("UnitsInStock").AsInt16().Nullable() .WithColumn("UnitsOnOrder").AsInt16().Nullable() .WithColumn("ReorderLevel").AsInt16().Nullable(); addCols(IfDatabase(MigrationUtils.AllExceptOracle) .Create.Table("ProductLog") .WithColumn("ProductLogID").AsInt64().PrimaryKey().Identity().NotNullable()); addCols(IfDatabase("oracle") .Create.Table("ProductLog") .WithColumn("ProductLogID").AsInt64().PrimaryKey().NotNullable()); MigrationUtils.AddOracleIdentity(this, "ProductLog", "ProductLogID"); }
public override void Up() { IfDatabase("SqlServer", "SqlServer2000", "SqlServerCe") .Execute.Sql(GetScript("Serenity.Demo.Northwind.Migrations.NorthwindDBScript_SqlServer.sql")); IfDatabase("Postgres") .Execute.Sql(GetScript("Serenity.Demo.Northwind.Migrations.NorthwindDBScript_Postgres.sql")); IfDatabase("Postgres") .Execute.Sql(GetScript("Serenity.Demo.Northwind.Migrations.NorthwindDBScript_PostgresData.sql")); IfDatabase("MySql") .Execute.Sql(GetScript("Serenity.Demo.Northwind.Migrations.NorthwindDBScript_MySql.sql")); IfDatabase("Oracle") .Execute.Sql(GetScript("Serenity.Demo.Northwind.Migrations.NorthwindDBScript_Oracle.sql")); IfDatabase("Sqlite") .Execute.Sql(GetScript("Serenity.Demo.Northwind.Migrations.NorthwindDBScript_Sqlite.sql")); IfDatabase("SqlServer", "SqlServer2000", "SqlServerCe", "Postgres") .Alter.Table("Customers") .AddColumn("ID").AsInt32().Identity().NotNullable(); IfDatabase("Oracle") .Alter.Table("Customers") .AddColumn("ID").AsInt32().Nullable(); MigrationUtils.AddOracleIdentity(this, "Customers", "ID"); IfDatabase("Oracle") .Execute.Sql("UPDATE Customers SET ID = CUSTOMERS_SEQ.nextval"); IfDatabase("Oracle") .Alter.Column("ID").OnTable("Customers") .AsInt32().NotNullable(); IfDatabase("SqlServer", "SqlServer2000", "SqlServerCe", "Postgres") .Alter.Table("Territories") .AddColumn("ID").AsInt32().Identity(); IfDatabase("Oracle") .Alter.Table("Territories") .AddColumn("ID").AsInt32().Nullable(); MigrationUtils.AddOracleIdentity(this, "Territories", "ID"); IfDatabase("Oracle") .Execute.Sql("UPDATE Territories SET ID = Territories_SEQ.nextval"); IfDatabase("Oracle") .Alter.Column("ID").OnTable("Territories") .AsInt32().NotNullable(); Alter.Table("Products") .AddColumn("ProductImage").AsString(100).Nullable(); }
public override void Up() { Action <ICreateTableWithColumnSyntax> addColumns = expr => expr .WithColumn("ParentId").AsInt32().Nullable() .WithColumn("Title").AsString(100).NotNullable(); addColumns(IfDatabase(MigrationUtils.AllExceptOracle) .Create.Table("DragDropSample") .WithColumn("Id").AsInt32().Identity().PrimaryKey().NotNullable()); addColumns(IfDatabase("Oracle") .Create.Table("DragDropSample") .WithColumn("Id").AsInt32().PrimaryKey().NotNullable()); MigrationUtils.AddOracleIdentity(this, "DragDropSample", "Id"); }
public override void Up() { IfDatabase(MigrationUtils.AllExceptOracle) .Create.Table("CustomerRepresentatives") .WithColumn("RepresentativeID").AsInt32().PrimaryKey().Identity().NotNullable() .WithColumn("CustomerID").AsInt32().NotNullable() .WithColumn("EmployeeID").AsInt32().NotNullable(); IfDatabase("Oracle") .Create.Table("CustomerRepresentatives") .WithColumn("RepresentativeID").AsInt32().PrimaryKey().NotNullable() .WithColumn("CustomerID").AsInt32().NotNullable() .WithColumn("EmployeeID").AsInt32().NotNullable(); MigrationUtils.AddOracleIdentity(this, "CustomerRepresentatives", "RepresentativeID"); }
public override void Up() { Action <ICreateTableWithColumnSyntax> addCols = expr => expr .WithColumn("EntityType").AsString(100).NotNullable() .WithColumn("EntityID").AsInt64().NotNullable() .WithColumn("Text").AsString(int.MaxValue).NotNullable() .WithColumn("InsertUserId").AsInt32().NotNullable() .WithColumn("InsertDate").AsDateTime().NotNullable(); addCols(IfDatabase(MigrationUtils.AllExceptOracle) .Create.Table("Notes") .WithColumn("NoteID").AsInt64().PrimaryKey().Identity().NotNullable()); addCols(IfDatabase("Oracle") .Create.Table("Notes") .WithColumn("NoteID").AsInt64().PrimaryKey().NotNullable()); MigrationUtils.AddOracleIdentity(this, "Notes", "NoteID"); }
public override void Up() { IfDatabase("SqlServer", "SqlServer2000", "SqlServerCe", "Postgres") .Alter.Table("Order Details") .AddColumn("DetailID").AsInt32().Identity().NotNullable(); IfDatabase("oracle") .Alter.Table("\"ORDER DETAILS\"") .AddColumn("DetailID").AsInt32().Nullable(); MigrationUtils.AddOracleIdentity(this, "\"ORDER DETAILS\"", "DetailID"); IfDatabase("Oracle") .Execute.Sql("UPDATE \"ORDER DETAILS\" SET DetailID = Order_Details_SEQ.nextval"); IfDatabase("Oracle") .Alter.Column("DetailID").OnTable("\"ORDER DETAILS\"") .AsInt32().NotNullable(); }
public override void Up() { IfDatabase(MigrationUtils.AllExceptOracle) .Create.Table("CategoryLang") .WithColumn("ID").AsInt32().PrimaryKey().Identity().NotNullable() .WithColumn("CategoryID").AsInt32().NotNullable() .WithColumn("LanguageID").AsInt32().NotNullable() .WithColumn("CategoryName").AsString(15).Nullable() .WithColumn("Description").AsString(int.MaxValue).Nullable(); IfDatabase("Oracle") .Create.Table("CategoryLang") .WithColumn("ID").AsInt32().PrimaryKey().NotNullable() .WithColumn("CategoryID").AsInt32().NotNullable() .WithColumn("LanguageID").AsInt32().NotNullable() .WithColumn("CategoryName").AsString(15).Nullable() .WithColumn("Description").AsString(int.MaxValue).Nullable(); MigrationUtils.AddOracleIdentity(this, "CategoryLang", "ID"); IfDatabase(MigrationUtils.AllExceptOracle) .Create.Table("ProductLang") .WithColumn("ID").AsInt32().PrimaryKey().Identity().NotNullable() .WithColumn("ProductID").AsInt32().NotNullable() .WithColumn("LanguageID").AsInt32().NotNullable() .WithColumn("ProductName").AsString(40).Nullable(); IfDatabase("Oracle") .Create.Table("ProductLang") .WithColumn("ID").AsInt32().PrimaryKey().NotNullable() .WithColumn("ProductID").AsInt32().NotNullable() .WithColumn("LanguageID").AsInt32().NotNullable() .WithColumn("ProductName").AsString(40).Nullable(); MigrationUtils.AddOracleIdentity(this, "ProductLang", "ID"); }