Пример #1
0
        /// <summary>
        /// Updates the merchProductAttribute table adding the columns.
        /// </summary>
        public override void Up()
        {
            var database = ApplicationContext.Current.DatabaseContext.Database;
            var columns  = SqlSyntax.GetColumnsInSchema(database).ToArray();

            // 'shared' column
            if (columns.Any(
                    x => x.TableName.InvariantEquals("merchProductAttribute") && x.ColumnName.InvariantEquals("detachedContentValues"))
                == false)
            {
                Logger.Info(typeof(AddProductAttributeColumns), "Adding detachedContentValues column to merchProductAttribute table.");

                //// Add the new 'shared' column
                var textType = SqlSyntax.GetSpecialDbType(SpecialDbTypes.NTEXT);
                Create.Column("detachedContentValues").OnTable("merchProductAttribute").AsCustom(textType).Nullable();
            }

            // 'isDefaultChoice' column
            if (columns.Any(
                    x => x.TableName.InvariantEquals("merchProductAttribute") && x.ColumnName.InvariantEquals("isDefaultChoice"))
                == false)
            {
                Logger.Info(typeof(AddProductAttributeColumns), "Adding isDefaultChoice column to merchProductAttribute table.");

                //// Add the new 'isDefaultChoice' column
                Create.Column("isDefaultChoice").OnTable("merchProductAttribute").AsBoolean().WithDefaultValue(false);
            }
        }
Пример #2
0
        public override void Migrate()
        {
            var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();

            if (tables.InvariantContains("cmsContentNu"))
            {
                return;
            }

            var textType = SqlSyntax.GetSpecialDbType(SpecialDbTypes.NTEXT);

            Create.Table("cmsContentNu")
            .WithColumn("nodeId").AsInt32().NotNullable()
            .WithColumn("published").AsBoolean().NotNullable()
            .WithColumn("data").AsCustom(textType).NotNullable()
            .WithColumn("rv").AsInt64().NotNullable().WithDefaultValue(0)
            .Do();

            Create.PrimaryKey("PK_cmsContentNu")
            .OnTable("cmsContentNu")
            .Columns(new[] { "nodeId", "published" })
            .Do();

            Create.ForeignKey("FK_cmsContentNu_umbracoNode_id")
            .FromTable("cmsContentNu")
            .ForeignColumn("nodeId")
            .ToTable("umbracoNode")
            .PrimaryColumn("id")
            .OnDelete(Rule.Cascade)
            .OnUpdate(Rule.None)
            .Do();
        }
        public override void Up()
        {
            //Don't exeucte if the column is already there
            var columns = SqlSyntax.GetColumnsInSchema(Context.Database).ToArray();

            if (columns.Any(x => x.TableName.InvariantEquals("umbracoUser") && x.ColumnName.InvariantEquals("tourData")) == false)
            {
                var textType = SqlSyntax.GetSpecialDbType(SpecialDbTypes.NTEXT);
                Create.Column("tourData").OnTable("umbracoUser").AsCustom(textType).Nullable();
            }
        }
        public override void Up()
        {
            var columns = SqlSyntax.GetColumnsInSchema(Context.Database).Distinct().ToArray();

            //Check if it's already text
            if (columns.Any(x => x.ColumnName.InvariantEquals("value") && x.TableName.InvariantEquals("cmsDataTypePreValues")
                            //mysql check
                            && (x.DataType.InvariantEquals("longtext") == false
                            //sql server check
                                && x.DataType.InvariantEquals("ntext") == false)))
            {
                //To text
                var textType = SqlSyntax.GetSpecialDbType(SpecialDbTypes.NTEXT);
                Alter.Table("cmsDataTypePreValues").AlterColumn("value").AsCustom(textType).Nullable();
            }
        }
        public override void Up()
        {
            //Don't exeucte if the table is already there
            var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();

            if (tables.InvariantContains("umbracoCacheInstruction"))
            {
                return;
            }

            var textType = SqlSyntax.GetSpecialDbType(SpecialDbTypes.NTEXT);

            Create.Table("umbracoCacheInstruction")
            .WithColumn("id").AsInt32().NotNullable().PrimaryKey("PK_umbracoCacheInstruction").Identity()
            .WithColumn("utcStamp").AsDateTime().NotNullable()
            .WithColumn("jsonInstruction").AsCustom(textType).NotNullable()
            .WithColumn("originated").AsString(500).NotNullable();
        }