Exemple #1
0
 private void AlterTableUsingNewAddAndNewAdd()
 {
     Alter.Table("Sample")
     .AddColumn("NewAddSyntax", col => col.AsInt32())
     .AddColumn("NewAddSyntax", col => col.AsInt32());
 }
Exemple #2
0
 public override void Up()
 {
     Alter.Column("siteid").OnTable("SW_USER2").AsString(50).Nullable();
     Alter.Column("orgid").OnTable("SW_USER2").AsString(50).Nullable();
 }
 public override void Up()
 {
     Alter.Table("GoodEntries").AddColumn("Title").AsString().NotNullable();
 }
Exemple #4
0
 public override void Up()
 {
     Alter.Table("users")
     .AddColumn("profile_img").AsString().Nullable();
 }
Exemple #5
0
        public override void Up()
        {
            //now that the controlId column is renamed and now a string we need to convert
            if (Context == null || Context.Database == null)
            {
                return;
            }

            //var cpt = SqlSyntaxContext.SqlSyntaxProvider.GetConstraintsPerTable(Context.Database);
            //var di = SqlSyntaxContext.SqlSyntaxProvider.GetDefinedIndexes(Context.Database);

            if (Context.CurrentDatabaseProvider != DatabaseProviders.SqlServer)
            {
                Delete.DefaultConstraint().OnTable("cmsMacroProperty").OnColumn("macroPropertyHidden");
            }
            else
            {
                //If we are on SQLServer, we need to delete default constraints by name, older versions of umbraco did not name these default constraints
                // consistently so we need to look up the constraint name to delete, this only pertains to SQL Server and this issue:
                // http://issues.umbraco.org/issue/U4-4133
                var sqlServerSyntaxProvider = new SqlServerSyntaxProvider();
                var defaultConstraints      = sqlServerSyntaxProvider.GetDefaultConstraintsPerColumn(Context.Database).Distinct();

                //lookup the constraint we want to delete, normally would be called "DF_cmsMacroProperty_macroPropertyHidden" but
                // we cannot be sure with really old versions
                var constraint = defaultConstraints
                                 .SingleOrDefault(x => x.Item1 == "cmsMacroProperty" && x.Item2 == "macroPropertyHidden");
                if (constraint != null)
                {
                    Execute.Sql(string.Format("ALTER TABLE [{0}] DROP CONSTRAINT [{1}]", "cmsMacroProperty", constraint.Item3));
                }
            }

            Delete.Column("macroPropertyHidden").FromTable("cmsMacroProperty");

            if (Context.CurrentDatabaseProvider == DatabaseProviders.MySql)
            {
                Delete.ForeignKey().FromTable("cmsMacroProperty").ForeignColumn("macroPropertyType").ToTable("cmsMacroPropertyType").PrimaryColumn("id");
            }
            else
            {
                //Before we try to delete this constraint, we'll see if it exists first, some older schemas never had it and some older schema's had this named
                // differently than the default.

                var keyConstraints = SqlSyntax.GetConstraintsPerColumn(Context.Database).Distinct();
                var constraint     = keyConstraints
                                     .SingleOrDefault(x => x.Item1 == "cmsMacroProperty" && x.Item2 == "macroPropertyType" && x.Item3.InvariantStartsWith("PK_") == false);
                if (constraint != null)
                {
                    Delete.ForeignKey(constraint.Item3).OnTable("cmsMacroProperty");
                }
            }

            Alter.Table("cmsMacroProperty").AddColumn("editorAlias").AsString(255).NotNullable().WithDefaultValue("");

            //we need to get the data and create the migration scripts before we change the actual schema bits below!
            var list = Context.Database.Fetch <dynamic>("SELECT * FROM cmsMacroPropertyType");

            foreach (var item in list)
            {
                var alias = item.macroPropertyTypeAlias;
                //check if there's a map created
                var newAlias = (string)LegacyParameterEditorAliasConverter.GetNewAliasFromLegacyAlias(alias);
                if (newAlias.IsNullOrWhiteSpace() == false)
                {
                    alias = newAlias;
                }

                //update the table with the alias, the current macroPropertyType will contain the original id
                Update.Table("cmsMacroProperty").Set(new { editorAlias = alias }).Where(new { macroPropertyType = item.id });
            }

            //drop the column now
            Delete.Column("macroPropertyType").FromTable("cmsMacroProperty");

            //drop the default constraint
            Delete.DefaultConstraint().OnTable("cmsMacroProperty").OnColumn("editorAlias");
        }
Exemple #6
0
 public override void Up()
 {
     Alter.Table("Pessoa")
     .AlterColumn("Name").AsFixedLengthAnsiString(60).Nullable();
 }
        protected override void MainDbUpgrade()
        {
            Alter.Table("Episodes").AddColumn("AirDateUtc").AsDateTime().Nullable();

            Execute.Sql("UPDATE Episodes SET AirDateUtc = AirDate");
        }
Exemple #8
0
	void Awake() {
		instance = this;
	}
Exemple #9
0
 public override void Up()
 {
     Alter.Table("Log")
     .AddColumn("Number").AsInt32();
 }
 public override void Up()
 {
     Delete.Column("State").FromTable("Votes");
     Alter.Table("Votes").AddColumn("Published").AsBoolean().NotNullable().WithDefaultValue(false);
 }
Exemple #11
0
 protected override void MainDbUpgrade()
 {
     Alter.Table("Series")
     .AlterColumn("ImdbId").AsString().Nullable()
     .AlterColumn("TitleSlug").AsString().Nullable();
 }
 public override void Down()
 {
     Delete.Column("Published").FromTable("Votes");
     Alter.Table("Votes").AddColumn("State").AsString(255).NotNullable().WithDefaultValue("draft");
 }
Exemple #13
0
 public override void Up()
 {
     Alter.Table("Users").AddColumn("StripeSubscriptionId").AsString(255).Nullable();
     Update.Table("Users").Set(new { StripeSubscriptionId = "" }).AllRows();
     Alter.Table("Users").AlterColumn("StripeSubscriptionId").AsString(255).NotNullable();
 }
Exemple #14
0
 public override void Up()
 {
     Delete.Column("pad_id").FromTable("reviews");
     Alter.Table("reviews").AddColumn("pad_color_id").AsGuid().ForeignKey("pad_colors", "id");
 }
 /// <summary>
 /// Migrate up.
 /// </summary>
 public override void Up()
 {
     Alter.Table("Medias").InSchema(SchemaName)
     .AddColumn("ImageId").AsGuid().Nullable();
 }
Exemple #16
0
 public override void Up()
 {
     Alter.Table("subscriptions").AddColumn("price_billing_id").AsString(255);
 }
Exemple #17
0
 public override void Down()
 {
     Alter.Table("Pessoa")
     .AlterColumn("Name").AsFixedLengthString(60);
 }
 public override void Up()
 {
     Alter.Column("playerDescription").OnTable("jobs").AsCustom("longtext").NotNullable();
     Alter.Column("playerSummary").OnTable("jobs").AsCustom("text").NotNullable();
 }
 public override void Up()
 {
     Alter.Table("Candidates")
     .AddColumn("HasBeenPromptedForPrn").AsBoolean().NotNullable().WithDefaultValue(false)
     .AddColumn("ProfessionalRegistrationNumber").AsString(32).Nullable();
 }
 protected override void MainDbUpgrade()
 {
     Alter.Table("ScheduledTasks").AlterColumn("Interval").AsDouble();
     Execute.Sql("UPDATE ScheduledTasks SET Interval=0.25 WHERE TypeName='NzbDrone.Core.Download.CheckForFinishedDownloadCommand'");
 }
 public override void Up()
 {
     Alter.Table("CandidateAssessmentSupervisors").AddColumn("Removed").AsDateTime().Nullable();
 }
 public override void Down()
 {
     Alter.Table("call_queue")
     .AddColumn("transaction_id").AsString().WithDefaultValue(String.Empty);
 }
 protected override void MainDbUpgrade()
 {
     Alter.Table("Profiles").AddColumn("PreferredTags").AsString().Nullable();
 }
 public override void Up()
 {
     Alter.Table("EmployeesAddresses").InSchema("ldg")
     .AddColumn("AddressTypeId").AsInt16().Nullable();
 }
Exemple #25
0
 public override void Up()
 {
     Alter.Table("PageComment")
     .AddColumn("LastModified").AsDateTime2().NotNullable()
     ;
 }
        public override void Up()
        {
            if (!Schema.Schema(SchemaName).Table("Categories").Column("ParentCategoryId").Exists())
            {
                Create
                .Column("ParentCategoryId")
                .OnTable("Categories").InSchema(SchemaName)
                .AsGuid()
                .Nullable();

                Create
                .ForeignKey("Fk_Cms_Categories_ParentCategoryId__Categories_Id")
                .FromTable("Categories").InSchema(SchemaName).ForeignColumn("ParentCategoryId")
                .ToTable("Categories").InSchema(SchemaName).PrimaryColumn("Id");
            }

            if (!Schema.Schema(SchemaName).Table("Categories").Column("DisplayOrder").Exists())
            {
                Create
                .Column("DisplayOrder")
                .OnTable("Categories").InSchema(SchemaName)
                .AsInt32().NotNullable().WithDefaultValue(0);
            }

            if (!Schema.Schema(SchemaName).Table("Categories").Column("Macro").Exists())
            {
                Create
                .Column("Macro")
                .OnTable("Categories").InSchema(SchemaName)
                .AsString(MaxLength.Text).Nullable();
            }

            if (!Schema.Schema(SchemaName).Table("CategoryTrees").Exists())
            {
                Create
                .Table("CategoryTrees").InSchema(SchemaName)
                .WithCmsBaseColumns()
                .WithColumn("Title").AsString(MaxLength.Name).NotNullable();

                CreateDefaultCategoryTree();
            }

            if (!Schema.Schema(SchemaName).Table("Categories").Column("CategoryTreeId").Exists())
            {
                Create
                .Column("CategoryTreeId")
                .OnTable("Categories").InSchema(SchemaName)
                .AsGuid().Nullable();

                Update
                .Table("Categories").InSchema(SchemaName)
                .Set(new { CategoryTreeId = DefaultCategoryTreeId })
                .AllRows();

                Alter
                .Table("Categories").InSchema(SchemaName)
                .AlterColumn("CategoryTreeId")
                .AsGuid().NotNullable();

                Create
                .ForeignKey("FK_Cms_Categories_CategoryTreeId_Cms_CategoryTree_Id")
                .FromTable("Categories").InSchema(SchemaName).ForeignColumn("CategoryTreeId")
                .ToTable("CategoryTrees").InSchema(SchemaName).PrimaryColumn("Id");

                Create
                .Index("IX_Cms_Categories_CategoryTreeId")
                .OnTable("Categories").InSchema(SchemaName).OnColumn("CategoryTreeId");
            }
        }
Exemple #27
0
 protected override void MainDbUpgrade()
 {
     Alter.Table("Notifications").AddColumn("OnHealthIssue").AsBoolean().WithDefaultValue(0);
     Alter.Table("Notifications").AddColumn("IncludeHealthWarnings").AsBoolean().WithDefaultValue(0);
 }
Exemple #28
0
 public override void Up()
 {
     Alter.Table("Movie").InSchema("mov")
     .AddColumn("TestField").AsString(100).Nullable();
 }
        protected override void MainDbUpgrade()
        {
			Alter.Table("Movies").AddColumn("PhysicalReleaseNote").AsString().Nullable();
        }
Exemple #30
0
 public override void Down()
 {
     Delete.Column("image_name").Column("image_data").FromTable("pads");
     Alter.Table("pads").AddColumn("image").AsBinary();
 }
		protected ApplicationTypesBase( Func<ImmutableArray<Assembly>> assemblySource, Alter<IEnumerable<Assembly>> filter, Func<IEnumerable<Assembly>, IEnumerable<Type>> partsSource )
		{
			this.assemblySource = assemblySource;
			this.filter = filter;
			this.partsSource = partsSource;
		}
 public override void Up()
 {
     Alter.Table("Patients")
     .AddColumn("City").AsString(200).Nullable()
     .AddColumn("Country").AsString(200).Nullable();
 }