Beispiel #1
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 table is already there
            var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();

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

            Create.Table("umbracoDeployChecksum")
            .WithColumn("id").AsInt32().Identity().PrimaryKey("PK_umbracoDeployChecksum")
            .WithColumn("entityType").AsString(32).NotNullable()
            .WithColumn("entityGuid").AsGuid().Nullable()
            .WithColumn("entityPath").AsString(256).Nullable()
            .WithColumn("localChecksum").AsString(32).NotNullable()
            .WithColumn("compositeChecksum").AsString(32).Nullable();

            Create.Table("umbracoDeployDependency")
            .WithColumn("sourceId").AsInt32().NotNullable().ForeignKey("FK_umbracoDeployDependency_umbracoDeployChecksum_id1", "umbracoDeployChecksum", "id")
            .WithColumn("targetId").AsInt32().NotNullable().ForeignKey("FK_umbracoDeployDependency_umbracoDeployChecksum_id2", "umbracoDeployChecksum", "id")
            .WithColumn("mode").AsInt32().NotNullable();

            Create.PrimaryKey("PK_umbracoDeployDependency").OnTable("umbracoDeployDependency").Columns(new[] { "sourceId", "targetId" });

            Create.Index("IX_umbracoDeployChecksum").OnTable("umbracoDeployChecksum")
            .OnColumn("entityType")
            .Ascending()
            .OnColumn("entityGuid")
            .Ascending()
            .OnColumn("entityPath")
            .Unique();
        }
Beispiel #3
0
        public override void Up()
        {
            //Don't exeucte if the table is already there
            var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();

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

            Create.Table("umbracoMigration")
            .WithColumn("id").AsInt32().NotNullable().PrimaryKey("PK_umbracoMigrations").Identity()
            .WithColumn("name").AsString(255).NotNullable()
            .WithColumn("version").AsString(50).NotNullable()
            .WithColumn("createDate").AsDateTime().NotNullable().WithDefault(SystemMethods.CurrentDateTime);

            //unique constraint on name + version
            Create.Index("IX_umbracoMigration").OnTable("umbracoMigration")
            .OnColumn("name").Ascending()
            .OnColumn("version").Ascending()
            .WithOptions()
            .NonClustered()
            .WithOptions()
            .Unique();
        }
        public override void Up()
        {
            Logger.Debug <CreateSprintProgressTable>("Looking for tables.");

            var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();
            var dSprintProgressExists = tables.InvariantContains("dSprintProgress");

            if (!dSprintProgressExists)
            {
                Create.Table <SprintProgressDto>();

                /*
                 * Create.Table("dSprintProgress")
                 *  .WithColumn("sprintId").AsInt32().NotNullable()
                 *  .WithColumn("dateTime").AsDateTime().NotNullable()
                 *  .WithColumn("jsonData").AsString(512).NotNullable();
                 * Create.Index("IX_dSprintProgress")
                 *  .OnTable("dSprintProgress")
                 *  .OnColumn("sprintId").Ascending()
                 *  .OnColumn("dateTime").Ascending()
                 *  .WithOptions().Unique()
                 *  .WithOptions().NonClustered();
                 */
            }

            Logger.Debug <CreateSprintProgressTable>("Done.");
        }
Beispiel #5
0
        public override void Migrate()
        {
            var tables      = SqlSyntax.GetTablesInSchema(Context.Database).ToList();
            var constraints = SqlSyntax.GetConstraintsPerColumn(Context.Database).Distinct().ToArray();
            var columns     = SqlSyntax.GetColumnsInSchema(Context.Database).ToArray();

            //In some very rare cases, there might alraedy be user group tables that we'll need to remove first
            //but of course we don't want to remove the tables we will be creating below if they already exist so
            //need to do some checks first since these old rare tables have a different schema
            RemoveOldTablesIfExist(tables, columns);

            if (AddNewTables(tables))
            {
                MigrateUserPermissions();
                MigrateUserTypesToGroups();
                DeleteOldTables(tables, constraints);
                SetDefaultIcons();
            }
            else
            {
                //if we aren't adding the tables, make sure that the umbracoUserGroup table has the correct FKs - these
                //were added after the beta release so we need to do some cleanup
                //if the FK doesn't exist
                if (constraints.Any(x => x.Item1.InvariantEquals("umbracoUserGroup") &&
                                    x.Item2.InvariantEquals("startContentId") &&
                                    x.Item3.InvariantEquals("FK_startContentId_umbracoNode_id")) == false)
                {
                    //before we add any foreign key we need to make sure there's no stale data in there which would  have happened in the beta
                    //release if a start node was assigned and then that start node was deleted.
                    Database.Execute(@"UPDATE umbracoUserGroup SET startContentId = NULL WHERE startContentId NOT IN (SELECT id FROM umbracoNode)");

                    Create.ForeignKey("FK_startContentId_umbracoNode_id")
                    .FromTable("umbracoUserGroup")
                    .ForeignColumn("startContentId")
                    .ToTable("umbracoNode")
                    .PrimaryColumn("id")
                    .OnDelete(Rule.None)
                    .OnUpdate(Rule.None)
                    .Do();
                }

                if (constraints.Any(x => x.Item1.InvariantEquals("umbracoUserGroup") &&
                                    x.Item2.InvariantEquals("startMediaId") &&
                                    x.Item3.InvariantEquals("FK_startMediaId_umbracoNode_id")) == false)
                {
                    //before we add any foreign key we need to make sure there's no stale data in there which would  have happened in the beta
                    //release if a start node was assigned and then that start node was deleted.
                    Database.Execute(@"UPDATE umbracoUserGroup SET startMediaId = NULL WHERE startMediaId NOT IN (SELECT id FROM umbracoNode)");

                    Create.ForeignKey("FK_startMediaId_umbracoNode_id")
                    .FromTable("umbracoUserGroup")
                    .ForeignColumn("startMediaId")
                    .ToTable("umbracoNode")
                    .PrimaryColumn("id")
                    .OnDelete(Rule.None)
                    .OnUpdate(Rule.None)
                    .Do();
                }
            }
        }
Beispiel #6
0
        public override void Up()
        {
            var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();

            if (!tables.InvariantContains(Comments.Table))
            {
                Create.Table <UserCommentDTO>();
            }
        }
Beispiel #7
0
        public override void Up()
        {
            var tables = SqlSyntax.GetTablesInSchema(Context.Database);

            if (!tables.InvariantContains(Forums.Table))
            {
                Create.Table <ForumPostsDTO>();
            }
        }
Beispiel #8
0
        public override void Migrate()
        {
            var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();

            if (tables.InvariantContains(nameof(FormulateSubmission)) == false)
            {
                Create.Table <FormulateSubmission>().Do();
            }
        }
        public override void Up()
        {
            var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();

            if (tables.InvariantContains("umbracoUserLogin") == false)
            {
                Create.Table <UserLoginDto>();
            }
        }
Beispiel #10
0
        public override void Migrate()
        {
            var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();

            if (tables.InvariantContains(Constants.DatabaseSchema.Tables.UserLogin) == false)
            {
                Create.Table <UserLoginDto>().Do();
            }
        }
        public override void Up()
        {
            var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();

            if (!tables.InvariantContains("Aubergine_Configuration"))
            {
                Create.Table <AubergineConfig>();
            }
        }
        public override void Up()
        {
            var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();

            if (tables.InvariantContains(AuditEntryDto.TableName))
            {
                return;
            }
            Create.Table <AuditEntryDto>();
        }
Beispiel #13
0
        public override void Down()
        {
            Logger.Debug <CreateTableMigration>("Deleting tables");
            var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();

            if (tables.InvariantContains(MigrationDemoApp.SimpleTableName))
            {
                Delete.Table(MigrationDemoApp.SimpleTableName);
            }
        }
Beispiel #14
0
    private void CreateDatabaseTable()
    {
        // Add CreatedPackage table in database if it doesn't exist
        IEnumerable <string> tables = SqlSyntax.GetTablesInSchema(Context.Database);

        if (!tables.InvariantContains(CreatedPackageSchemaDto.TableName))
        {
            Create.Table <CreatedPackageSchemaDto>().Do();
        }
    }
    protected override void Migrate()
    {
        IEnumerable <string> tables = SqlSyntax.GetTablesInSchema(Context.Database);

        if (tables.InvariantContains(TwoFactorLoginDto.TableName))
        {
            return;
        }

        Create.Table <TwoFactorLoginDto>().Do();
    }
Beispiel #16
0
        public override void Migrate()
        {
            var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();

            if (tables.InvariantContains(Constants.DatabaseSchema.Tables.Consent))
            {
                return;
            }

            Create.Table <ConsentDto>().Do();
        }
Beispiel #17
0
    protected override void Migrate()
    {
        IEnumerable <string> tables = SqlSyntax.GetTablesInSchema(Context.Database);

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

        Create.Table <ContentNuDto>(true).Do();
    }
        public override void Down()
        {
            Logger.Info <CreateATable>("1.0.0: Running Migration Down");

            var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();

            if (tables.InvariantContains("SomeDataTable"))
            {
                Delete.Table("SomeDataTable");
            }
        }
Beispiel #19
0
        public override void Migrate()
        {
            var tables = SqlSyntax.GetTablesInSchema(Context.Database);

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

            Create.Table <ContentNuDto>(true).Do();
        }
        public override void Up()
        {
            var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();

            if (tables.InvariantContains("cmsMedia") == false)
            {
                Create.Table <MediaDto>();

                MigrateMediaPaths();
            }
        }
Beispiel #21
0
        public override void Up()
        {
            var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();

            if (tables.InvariantContains("umbracoLock") == false)
            {
                Create.Table("umbracoLock")
                .WithColumn("id").AsInt32().PrimaryKey("PK_umbracoLock")
                .WithColumn("value").AsInt32().NotNullable()
                .WithColumn("name").AsString(64).NotNullable();
            }
        }
        public override void Migrate()
        {
            var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();

            if (tables.InvariantContains(Constants.DatabaseSchema.Tables.MediaVersion))
            {
                return;
            }

            Create.Table <MediaVersionDto>().Do();
            MigrateMediaPaths();
        }
Beispiel #23
0
    /// <remarks>
    ///     The conditionals are useful to enable the same migration to be used in multiple
    ///     migration paths x.x -> 8.18 and x.x -> 9.x
    /// </remarks>
    protected override void Migrate()
    {
        IEnumerable <string> tables = SqlSyntax.GetTablesInSchema(Context.Database);

        if (!tables.InvariantContains(ContentVersionCleanupPolicyDto.TableName))
        {
            Create.Table <ContentVersionCleanupPolicyDto>().Do();
        }

        IEnumerable <ColumnInfo> columns = SqlSyntax.GetColumnsInSchema(Context.Database);

        AddColumnIfNotExists <ContentVersionDto>(columns, "preventCleanup");
    }
        /// <remarks>
        /// The conditionals are useful to enable the same migration to be used in multiple
        /// migration paths x.x -> 8.18 and x.x -> 9.x
        /// </remarks>
        public override void Migrate()
        {
            var tables = SqlSyntax.GetTablesInSchema(Context.Database);

            if (!tables.InvariantContains(ContentVersionCleanupPolicyDto.TableName))
            {
                Create.Table <ContentVersionCleanupPolicyDto>().Do();
            }

            var columns = SqlSyntax.GetColumnsInSchema(Context.Database);

            AddColumnIfNotExists <ContentVersionDto>(columns, "preventCleanup");
        }
Beispiel #25
0
        public override void Up()
        {
            var updated = false;
            var tables  = SqlSyntax.GetTablesInSchema(Context.Database).ToList();

            //var constraints = SqlSyntax.GetConstraintsPerColumn(Context.Database).Distinct().ToArray();
            //var columns = SqlSyntax.GetColumnsInSchema(Context.Database).ToArray();

            if (tables.InvariantContains(PageViewCounter.SqlTableName) == false)
            {
                Create.Table <PageViewCounter>();
                updated = true;
            }
        }
        public override void Up()
        {
            var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();

            if (tables.InvariantContains(Constants.ProductName))
            {
                return;
            }

            Create.Table(Constants.ProductName)
            .WithColumn("userId").AsInt32().NotNullable()
            .WithColumn("key").AsString()
            .WithColumn("value").AsString()
            .WithColumn("confirmed").AsBoolean();
        }
        public override void Up()
        {
            var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();

            if (!tables.InvariantContains(UserContent.TableName))
            {
                Create.Table <UserContentDTO>();

                /*
                 * Create.Index("IX_UserContentKeyIndex")
                 *  .OnTable(UserContent.TableName)
                 *  .OnColumn("Key")
                 *  .Unique().WithOptions().NonClustered(); */
            }
        }
        public override void Up()
        {
            var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();

            if (tables.InvariantContains("umbracoUserStartNode") == false)
            {
                Create.Table <UserStartNodeDto>();

                MigrateUserStartNodes();

                //now remove the old columns

                Delete.Column("startStructureID").FromTable("umbracoUser");
                Delete.Column("startMediaID").FromTable("umbracoUser");
            }
        }
Beispiel #29
0
        public override void Up()
        {
            var tableName = "cmsPreviewXml";
            var tables    = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();

            if (tables.InvariantContains(tableName))
            {
                return;
            }

            Create.Table(tableName)
            .WithColumn("nodeId").AsInt32().NotNullable()
            .WithColumn("versionId").AsGuid().NotNullable()
            .WithColumn("timestamp").AsDateTime().NotNullable()
            .WithColumn("xml").AsString();
        }
Beispiel #30
0
        public override void Up()
        {
            //Don't exeucte if the table is already there
            var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();

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

            Create.Table("umbracoExternalLogin")
            .WithColumn("id").AsInt32().Identity().PrimaryKey("PK_umbracoExternalLogin")
            .WithColumn("userId").AsInt32().NotNullable().ForeignKey("FK_umbracoExternalLogin_umbracoUser_id", "umbracoUser", "id")
            .WithColumn("loginProvider").AsString(4000).NotNullable()
            .WithColumn("providerKey").AsString(4000).NotNullable()
            .WithColumn("createDate").AsDateTime().NotNullable().WithDefault(SystemMethods.CurrentDateTime);
        }