public override void Up() { Alter.Column("AssessmentQuestionID") .OnTable("CompetencyResourceAssessmentQuestionParameters") .AsInt32() .Nullable(); }
public override void Down() { Alter.Column("GroupLabel") .OnTable("Groups") .AsString(100) .NotNullable(); }
public override void Up() { Alter.Column("GroupLabel") .OnTable("Groups") .AsString(255) .NotNullable(); }
public override void Down() { Alter.Column("RespondBy").OnTable("SCR_Request").AsString(255).Nullable(); Execute.Sql("UPDATE SCR_Request SET RespondBy = OldRespondBy"); Delete.Column("OldRespondBy").FromTable("SCR_Request"); Delete.Column("RespondImmediately").FromTable("SCR_Request"); }
//see: http://issues.umbraco.org/issue/U4-6188, http://issues.umbraco.org/issue/U4-6187 public override void Up() { var dbIndexes = SqlSyntax.GetDefinedIndexes(Context.Database) .Select(x => new DbIndexDefinition() { TableName = x.Item1, IndexName = x.Item2, ColumnName = x.Item3, IsUnique = x.Item4 }).ToArray(); //must be non-nullable Alter.Column("uniqueID").OnTable("umbracoNode").AsGuid().NotNullable(); //make sure it already exists if (dbIndexes.Any(x => x.IndexName.InvariantEquals("IX_umbracoNodeUniqueID"))) { Delete.Index("IX_umbracoNodeUniqueID").OnTable("umbracoNode"); } //make sure it doesn't already exist if (dbIndexes.Any(x => x.IndexName.InvariantEquals("IX_umbracoNode_uniqueID")) == false) { //must be a uniqe index Create.Index("IX_umbracoNode_uniqueID").OnTable("umbracoNode").OnColumn("uniqueID").Unique(); } }
public override void Up() { Create.Column("blobvalue").OnTable("conf_propertyvalue").AsBinary().Nullable(); Create.Column("defaultblobvalue").OnTable("conf_propertydefinition").AsBinary().Nullable(); Alter.Column("defaultvalue").OnTable("conf_propertydefinition").AsString(4000).Nullable(); Alter.Column("value").OnTable("conf_propertyvalue").AsString(4000).Nullable(); }
public override void Up() { Delete.Index("IX_AdminUsers_Email").OnTable("AdminUsers"); Alter.Column("Email").OnTable("AdminUsers").AsString(255).Nullable(); Create.Index("IX_AdminUsers_Email").OnTable("AdminUsers").OnColumn("Email").Ascending().WithOptions() .Unique().WithOptions().NonClustered(); }
public override void Up() { Delete.DefaultConstraint().OnTable(TableNames.Tags).OnColumn("Description"); Alter.Column("Description").OnTable(TableNames.Tags).AsString(int.MaxValue).NotNullable().WithDefaultValue(string.Empty); Delete.DefaultConstraint().OnTable(TableNames.Tags).OnColumn("DescriptionEng"); Alter.Column("DescriptionEng").OnTable(TableNames.Tags).AsString(int.MaxValue).NotNullable().WithDefaultValue(string.Empty); }
public override void Up() { Delete.Column("LastActivity").FromTable("Users").InSchema("Users"); Alter.Column("Comments").OnTable("Sites").InSchema("Imports").AsString(1000); Alter.Column("Comments").OnTable("Subsites").InSchema("Imports").AsString(1000); Alter.Column("CrownComments").OnTable("Trees").InSchema("Imports").AsString(1000); Alter.Column("GeneralComments").OnTable("Trees").InSchema("Imports").AsString(1000); Alter.Column("GirthComments").OnTable("Trees").InSchema("Imports").AsString(1000); Alter.Column("HeightComments").OnTable("Trees").InSchema("Imports").AsString(1000); Alter.Column("TerrainComments").OnTable("Trees").InSchema("Imports").AsString(1000); Alter.Column("TreeFormComments").OnTable("Trees").InSchema("Imports").AsString(1000); Alter.Column("TrunkComments").OnTable("Trees").InSchema("Imports").AsString(1000); Execute.Sql("ALTER TABLE [Imports].[Trunks] DROP CONSTRAINT [DF_TrunkMeasurements_TrunkComments]"); Alter.Column("TrunkComments").OnTable("Trunks").InSchema("Imports").AsString(1000); Execute.Sql("ALTER TABLE [Imports].[Trunks] ADD CONSTRAINT [DF_TrunkMeasurements_TrunkComments] DEFAULT (N'') FOR [TrunkComments]"); Alter.Column("Comments").OnTable("SiteVisits").InSchema("Sites").AsString(1000); Alter.Column("Comments").OnTable("SubsiteVisits").InSchema("Sites").AsString(1000); Alter.Column("GeneralComments").OnTable("Measurements").InSchema("Trees").AsString(1000); }
public override void Down() { Create.Column("LastActivity").OnTable("Users").InSchema("Users").AsDateTime().NotNullable() .WithDefault(SystemMethods.CurrentDateTime); Alter.Column("Comments").OnTable("Sites").InSchema("Imports").AsAnsiString(300); Alter.Column("Comments").OnTable("Subsites").InSchema("Imports").AsAnsiString(300); Alter.Column("CrownComments").OnTable("Trees").InSchema("Imports").AsAnsiString(300); Alter.Column("GeneralComments").OnTable("Trees").InSchema("Imports").AsAnsiString(300); Alter.Column("GirthComments").OnTable("Trees").InSchema("Imports").AsAnsiString(300); Alter.Column("HeightComments").OnTable("Trees").InSchema("Imports").AsAnsiString(300); Alter.Column("TerrainComments").OnTable("Trees").InSchema("Imports").AsAnsiString(300); Alter.Column("TreeFormComments").OnTable("Trees").InSchema("Imports").AsAnsiString(300); Alter.Column("TrunkComments").OnTable("Trees").InSchema("Imports").AsAnsiString(300); Execute.Sql("ALTER TABLE [Imports].[Trunks] DROP CONSTRAINT [DF_TrunkMeasurements_TrunkComments]"); Alter.Column("TrunkComments").OnTable("Trunks").InSchema("Imports").AsAnsiString(300); Execute.Sql("ALTER TABLE [Imports].[Trunks] ADD CONSTRAINT [DF_TrunkMeasurements_TrunkComments] DEFAULT (N'') FOR [TrunkComments]"); Alter.Column("Comments").OnTable("SiteVisits").InSchema("Sites").AsAnsiString(300); Alter.Column("Comments").OnTable("SubsiteVisits").InSchema("Sites").AsAnsiString(300); Alter.Column("GeneralComments").OnTable("Measurements").InSchema("Trees").AsAnsiString(300); }
public override void Up() { Alter.Column("Name").OnTable("AbpUsers").AsString(32).NotNullable(); Alter.Column("Surname").OnTable("AbpUsers").AsString(32).NotNullable(); Alter.Column("EmailAddress").OnTable("AbpUsers").AsString(256).NotNullable(); Alter.Column("EmailConfirmationCode").OnTable("AbpUsers").AsString(128).Nullable(); Alter.Column("PasswordResetCode").OnTable("AbpUsers").AsString(328).Nullable(); Alter.Column("Password").OnTable("AbpUsers").AsString(128).NotNullable(); Alter.Table("AbpUsers") .AddColumn("AuthenticationSource").AsString(64).Nullable(); Create.Index("IX_IsDeleted_TenantId_EmailAddress") .OnTable("AbpUsers") .OnColumn("IsDeleted").Ascending() .OnColumn("TenantId").Ascending() .OnColumn("EmailAddress").Ascending() .WithOptions().NonClustered(); Create.Index("IX_IsDeleted_TenantId_UserName") .OnTable("AbpUsers") .OnColumn("IsDeleted").Ascending() .OnColumn("TenantId").Ascending() .OnColumn("UserName").Ascending() .WithOptions().NonClustered(); }
public override void Up() { if (Schema.Table("Order").Column("OrderedOn").Exists()) { Alter.Column("OrderedOn").OnTable("Order").AsDateTime().Nullable().WithDefaultValue(DateTime.Now); } }
public override void Down() { Alter.Table("Products") .AddColumn("Category") .AsString() .Nullable(); Execute.Sql("UPDATE p SET p.Category = (SELECT c.Name FROM dbo.Categories c WHERE c.Id = p.CategoryId) FROM dbo.Products p;"); Alter.Column("Category") .OnTable("Products") .AsString() .NotNullable(); Delete.ForeignKey() .FromTable("Products") .ForeignColumn("CategoryId") .ToTable("Categories") .PrimaryColumn("Id"); Delete.Index() .OnTable("Products") .OnColumn("CategoryId"); Delete.Column("CategoryId") .FromTable("Products"); Delete.Table("Categories"); }
public override void Up() { Alter.Column("DateBought") .OnTable("Program") .AsDate() .Nullable(); }
private void ConvertLinkedTableToUuid( string tableName, string foreignKey, string columnName, string newColumnName, string targetTableName, string targetColumnName, string previousIndexName ) { Alter.Table(tableName).AddColumn("tmpUuid").AsCustom("CHAR(36) CHARACTER SET ascii NOT NULL"); Execute.Sql($"UPDATE `{tableName}` SET `tmpUuid` = (SELECT `tmpBaseUuid` FROM `{targetTableName}` WHERE `{columnName}` = {targetColumnName})"); Delete.ForeignKey(foreignKey).OnTable(tableName); Alter.Column(columnName).OnTable(tableName).AsCustom("CHAR(36) CHARACTER SET ascii NOT NULL"); Execute.Sql($"UPDATE `{tableName}` SET `{columnName}` = `tmpUuid`"); Delete.Column("tmpUuid").FromTable(tableName); Rename.Column(columnName).OnTable(tableName).To(newColumnName); Alter.Column(newColumnName).OnTable(tableName).AsCustom("CHAR(36) CHARACTER SET ascii NOT NULL"); Delete.Index(previousIndexName).OnTable(tableName); Create.Index("IX_" + tableName + "_" + newColumnName).OnTable(tableName).OnColumn(newColumnName); Create.ForeignKey("FK_" + tableName + "_" + newColumnName + "_" + targetTableName + "_" + targetColumnName) .FromTable(tableName).ForeignColumn(newColumnName) .ToTable(targetTableName).PrimaryColumn("tmpBaseUuid") .OnDeleteOrUpdate(Rule.None); }
public override void Down() { Delete.Column("IsActive").FromTable("User_Card_Account").InSchema("Accounting"); Alter.Column("AccountNo").OnTable("User_Card_Account").InSchema("Accounting") .AsAccountNumber() .Nullable(); }
//TODO decompose to structure and data migration public override void Up() { // Add Name column to distinguish keys Alter.Table("ApiAccessKey") .AddColumn("Name").AsString(100).Nullable(); Update.Table("ApiAccessKey").Set(new { Name = "Vokabular" }).AllRows(); Alter.Column("Name").OnTable("ApiAccessKey").AsString(100).NotNullable(); // Table for permissions Create.Table("ApiAccessKeyPermission") .WithColumn("Id").AsInt32().NotNullable().PrimaryKey("PK_ApiAccessKeyPermission(Id)").Identity() .WithColumn("ApiAccessKeyId").AsInt32().NotNullable().ForeignKey("FK_ApiAccessKeyPermission(ApiAccessKeyId)", "ApiAccessKey", "Id") .WithColumn("Permission").AsInt32().NotNullable(); Execute.WithConnection((connection, transaction) => { var vokabularKeyId = Query.Conn(connection, transaction).Select <int>("Id").From("ApiAccessKey") .Where("Name", "Vokabular") .Run().Single(); var internalAccessPermission = 1; var userActivationPermission = 2; Query.Conn(connection, transaction).Insert("ApiAccessKeyPermission") .Row(new { ApiAccessKeyId = vokabularKeyId, Permission = internalAccessPermission }) .Row(new { ApiAccessKeyId = vokabularKeyId, Permission = userActivationPermission }) .Run(); }); }
public override void Up() { Create.Table("Categories") .WithColumn("Id").AsInt32().NotNullable().PrimaryKey().Identity() .WithColumn("Name").AsString(); Execute.Sql("INSERT INTO dbo.Categories SELECT DISTINCT Category FROM dbo.Products;"); Alter.Table("Products") .AddColumn("CategoryId") .AsInt32() .Nullable(); Execute.Sql("UPDATE p SET p.CategoryId = (SELECT c.Id FROM dbo.Categories c WHERE c.Name = p.Category) FROM dbo.Products p;"); Alter.Column("CategoryId") .OnTable("Products") .AsInt32() .NotNullable() .ForeignKey("Categories", "Id") .Indexed(); Delete.Column("Category") .FromTable("Products"); }
public override void Down() { Alter.Column(nameof(AbcMattressBase.ItemNo)).OnTable(nameof(AbcMattressBase)).AsInt32(); Alter.Column(nameof(AbcMattressEntry.ItemNo)).OnTable(nameof(AbcMattressEntry)).AsInt32(); Alter.Column(nameof(AbcMattressGift.ItemNo)).OnTable(nameof(AbcMattressGift)).AsInt32(); Alter.Column(nameof(AbcMattressPackage.ItemNo)).OnTable(nameof(AbcMattressPackage)).AsInt32(); }
public override void Up() { Alter.Table("job").AddColumn("data").AsCustom("json").NotNullable(); Execute.Sql("DELETE FROM `job` WHERE parentJob IS NOT NULL"); Execute.Sql("UPDATE job SET data = JSON_OBJECT()"); Execute.Sql("UPDATE job SET data = JSON_INSERT(data, '$.forOrigin', JSON_OBJECT());"); Execute.Sql("UPDATE job SET data = JSON_INSERT(data, '$.forOrigin.all', JSON_OBJECT());"); Execute.Sql("UPDATE job SET data = JSON_INSERT(data, '$.forOrigin.all.baseAt', baseAt) WHERE baseAt IS NOT NULL;"); Execute.Sql("UPDATE job SET data = JSON_INSERT(data, '$.forOrigin.all.baseEa', baseEa) WHERE baseEa IS NOT NULL;"); Execute.Sql("UPDATE job SET data = JSON_INSERT(data, '$.forOrigin.all.basePrd', basePrd) WHERE basePrd IS NOT NULL;"); Execute.Sql("UPDATE job SET data = JSON_INSERT(data, '$.forOrigin.all.bonusEv', bonusEv) WHERE bonusEv IS NOT NULL;"); Execute.Sql("UPDATE job SET data = JSON_INSERT(data, '$.forOrigin.all.factorEv', factorEv) WHERE factorEv IS NOT NULL;"); Execute.Sql("UPDATE job SET data = JSON_INSERT(data, '$.forOrigin.all.maxArmorPr', maxArmorPr) WHERE maxArmorPr IS NOT NULL;"); Execute.Sql("UPDATE job SET data = JSON_INSERT(data, '$.forOrigin.all.diceEaLevelUp', diceEaLevelUp) WHERE diceEaLevelUp IS NOT NULL;"); Execute.Sql("UPDATE job SET data = JSON_INSERT(data, '$.forOrigin.all.maxLoad', maxLoad) WHERE maxLoad IS NOT NULL;"); Delete.ForeignKey("FK_job_job_parentjob").OnTable("job"); Delete.Column("baseAt").FromTable("job"); Delete.Column("baseEa").FromTable("job"); Delete.Column("basePrd").FromTable("job"); Delete.Column("bonusEv").FromTable("job"); Delete.Column("factorEv").FromTable("job"); Delete.Column("maxArmorPr").FromTable("job"); Delete.Column("maxLoad").FromTable("job"); Delete.Column("baseEv").FromTable("job"); Delete.Column("diceEaLevelUp").FromTable("job"); Delete.Column("parentJob").FromTable("job"); Delete.Column("internalname").FromTable("job"); Alter.Column("name").OnTable("job").AsString(255); }
public override void Up() { Alter.Column("CheckoutDate") .OnTable("Invoices") .AsDateTime() .Nullable(); }
public override void Up() { if (this.Schema.Table(nameof(Product)).Column(nameof(Product.SpecificationFileName)).Exists()) { Alter.Column(nameof(Product.SpecificationFileName)) .OnTable(nameof(Product)) .AsString(256) .Nullable(); Alter.Column(nameof(Product.AccessoriesFileName)) .OnTable(nameof(Product)) .AsString(256) .Nullable(); } else { Create.Column(nameof(Product.SpecificationFileName)) .OnTable(nameof(Product)) .AsString(256) .Nullable(); Create.Column(nameof(Product.AccessoriesFileName)) .OnTable(nameof(Product)) .AsString(256) .Nullable(); } }
public override void Up() { if (this.Schema.Table(nameof(Product)).Column(nameof(Product.Margin)).Exists()) { Alter.Column(nameof(Product.Margin)) .OnTable(nameof(Product)) .AsDecimal() .Nullable(); Alter.Column(nameof(Product.MaxPrice)) .OnTable(nameof(Product)) .AsDecimal() .Nullable(); } else { Create.Column(nameof(Product.Margin)) .OnTable(nameof(Product)) .AsDecimal() .Nullable(); Create.Column(nameof(Product.MaxPrice)) .OnTable(nameof(Product)) .AsDecimal() .Nullable(); } }
public override void Up() { Alter. Column(GetColumnName((Db.File x) => x.TypeConcrete)). OnTable(GetTableName <Db.File>()). AsString(100).Nullable(); }
public override void Up() { Alter.Column("MaxValueDescription").OnTable("AssessmentQuestions").AsString(255).Nullable(); Alter.Column("MinValueDescription").OnTable("AssessmentQuestions").AsString(255).Nullable(); Alter.Table("CompetencyAssessmentQuestions").AddColumn("Ordering").AsInt32().NotNullable().WithDefaultValue(0); Rename.Column("LevelValueID").OnTable("AssessmentQuestionLevels").To("LevelValue"); }
public override void Down() { Alter.Column("MaxValueDescription").OnTable("AssessmentQuestions").AsString(int.MaxValue).NotNullable(); Alter.Column("MinValueDescription").OnTable("AssessmentQuestions").AsString(int.MaxValue).NotNullable(); Delete.Column("Ordering").FromTable("CompetencyAssessmentQuestions"); Rename.Column("LevelValue").OnTable("AssessmentQuestionLevels").To("LevelValueID"); }
public override void Up() { Alter.Column("criptoproperties").OnTable("SW_USER2").AsString(4000).Nullable(); Alter.Column("password").OnTable("SW_USER2").AsString(255).Nullable(); Alter.Column("department").OnTable("SW_USER2").AsString(200).Nullable(); Alter.Column("phone").OnTable("SW_USER2").AsString(20).Nullable(); Alter.Column("language").OnTable("SW_USER2").AsString(20).Nullable(); }
public override void Down() { Alter .Column("Date") .OnTable("Watch") .AsDate() .NotNullable(); }
/// <summary> /// Ups this instance. /// </summary> public override void Up() { Alter .Column("Description") .OnTable("Authors") .InSchema(SchemaName) .AsString(MaxLength.Max).Nullable(); }
public override void Up() { Alter.Column("SubscriptionEndDate").OnTable("Subscriptions") .AsDateTime().Nullable(); Alter.Table("Subscriptions") .AddColumn("Enabled").AsBoolean().NotNullable().WithDefaultValue(0); }