protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_ReleaseBatchItem_ReleaseBatch_ReleaseBatchId", schema: "kraken", table: "ReleaseBatchItem");
     migrationBuilder.AddUniqueConstraint(
         name: "AK_ReleaseBatch_Name",
         schema: "kraken",
         table: "ReleaseBatch",
         column: "Name");
     migrationBuilder.AddForeignKey(
         name: "FK_ReleaseBatchItem_ReleaseBatch_ReleaseBatchId",
         schema: "kraken",
         table: "ReleaseBatchItem",
         column: "ReleaseBatchId",
         principalSchema: "kraken",
         principalTable: "ReleaseBatch",
         principalColumn: "Id",
         onDelete: ReferentialAction.Cascade);
 }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<string>(
                name: "UniqueId",
                table: "Users",
                nullable: false);

            migrationBuilder.AddUniqueConstraint(
                name: "AK_Users_UniqueId",
                table: "Users",
                column: "UniqueId");

            migrationBuilder.AddUniqueConstraint(
                name: "AK_SectionMemberships_ClassroomMembershipId_SectionId",
                table: "SectionMemberships",
                columns: new[] { "ClassroomMembershipId", "SectionId" });

            migrationBuilder.AddUniqueConstraint(
                name: "AK_ClassroomMemberships_UserId_ClassroomId",
                table: "ClassroomMemberships",
                columns: new[] { "UserId", "ClassroomId" });

            migrationBuilder.AddUniqueConstraint(
                name: "AK_QuestionCategories_ClassroomId_Name",
                table: "QuestionCategories",
                columns: new[] { "ClassroomId", "Name" });

            migrationBuilder.AddUniqueConstraint(
                name: "AK_Questions_QuestionCategoryId_Name",
                table: "Questions",
                columns: new[] { "QuestionCategoryId", "Name" });

            migrationBuilder.AddUniqueConstraint(
                name: "AK_Sections_ClassroomId_Name",
                table: "Sections",
                columns: new[] { "ClassroomId", "Name" });

            migrationBuilder.AddUniqueConstraint(
                name: "AK_Classrooms_Name",
                table: "Classrooms",
                column: "Name");
        }
Ejemplo n.º 3
0
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn <int>(
                name: "Language",
                table: "Drafts",
                nullable: true,
                defaultValue: 1);

            migrationBuilder.AddColumn <DateTime>(
                name: "PublishDate",
                table: "Drafts",
                nullable: true,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn <string>(
                name: "Summary",
                table: "Drafts",
                nullable: true,
                defaultValue: "");

            migrationBuilder.AddColumn <string>(
                name: "Tags",
                table: "Drafts",
                nullable: true,
                defaultValue: "");

            migrationBuilder.AddColumn <string>(
                name: "Title",
                table: "Drafts",
                maxLength: 150,
                nullable: true,
                defaultValue: "");

            migrationBuilder.Sql(
                "UPDATE T1" +
                "SET T1.Language = T2.Language, T1.PublishDate = T2.PublishDate, T1.Summary = T2.Summary, T1.Tags = T2.Tags, T1.Title = T2.Title" +
                "FROM Drafts AS T1" +
                "INNER JOIN Infos AS T2 ON T1.Id = T2.Id");

            migrationBuilder.AlterColumn <int>(
                name: "Language",
                table: "Drafts",
                nullable: false);

            migrationBuilder.AlterColumn <DateTime>(
                name: "PublishDate",
                table: "Drafts",
                nullable: false);

            migrationBuilder.AlterColumn <string>(
                name: "Summary",
                table: "Drafts",
                nullable: false);

            migrationBuilder.AlterColumn <string>(
                name: "Tags",
                table: "Drafts",
                nullable: false);

            migrationBuilder.AlterColumn <string>(
                name: "Title",
                table: "Drafts",
                nullable: false);

            migrationBuilder.AddUniqueConstraint(
                name: "AK_Drafts_Title",
                table: "Drafts",
                column: "Title");

            migrationBuilder.DropTable(
                name: "Infos");
        }
 protected override void Down(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
     migrationBuilder.DropForeignKey(name: "FK_Contact_Item_Contact_contactId", table: "Contact_Item");
     migrationBuilder.DropForeignKey(name: "FK_Ferias_Funcionario_funcionarioId", table: "Ferias");
     migrationBuilder.DropForeignKey(name: "FK_Ferias_Itens_Funcionario_funcionarioId", table: "Ferias_Itens");
     migrationBuilder.DropForeignKey(name: "FK_FuncFerias_Funcionario_funcionarioId", table: "FuncFerias");
     migrationBuilder.DropForeignKey(name: "FK_FuncInfFerias_Funcionario_funcionarioId", table: "FuncInfFerias");
     migrationBuilder.DropForeignKey(name: "FK_Funcionario_Departamento_departamentoId", table: "Funcionario");
     migrationBuilder.DropForeignKey(name: "FK_Historio_Ferias_Item_Ferias_Itens_ferias_item_id", table: "Historio_Ferias_Item");
     migrationBuilder.AlterColumn<string>(
         name: "contactId",
         table: "Contact_Item",
         nullable: true);
     migrationBuilder.AddColumn<string>(
         name: "contactId",
         table: "Contact",
         nullable: false,
         defaultValue: "");
     migrationBuilder.AddUniqueConstraint(
         name: "AK_Contact_contactId",
         table: "Contact",
         column: "contactId");
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
         table: "AspNetRoleClaims",
         column: "RoleId",
         principalTable: "AspNetRoles",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
         table: "AspNetUserClaims",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
         table: "AspNetUserLogins",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
         table: "AspNetUserRoles",
         column: "RoleId",
         principalTable: "AspNetRoles",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
         table: "AspNetUserRoles",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_Contact_Item_Contact_contactId",
         table: "Contact_Item",
         column: "contactId",
         principalTable: "Contact",
         principalColumn: "contactId",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_Ferias_Funcionario_funcionarioId",
         table: "Ferias",
         column: "funcionarioId",
         principalTable: "Funcionario",
         principalColumn: "id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_Ferias_Itens_Funcionario_funcionarioId",
         table: "Ferias_Itens",
         column: "funcionarioId",
         principalTable: "Funcionario",
         principalColumn: "id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_FuncFerias_Funcionario_funcionarioId",
         table: "FuncFerias",
         column: "funcionarioId",
         principalTable: "Funcionario",
         principalColumn: "id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_FuncInfFerias_Funcionario_funcionarioId",
         table: "FuncInfFerias",
         column: "funcionarioId",
         principalTable: "Funcionario",
         principalColumn: "id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_Funcionario_Departamento_departamentoId",
         table: "Funcionario",
         column: "departamentoId",
         principalTable: "Departamento",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_Historio_Ferias_Item_Ferias_Itens_ferias_item_id",
         table: "Historio_Ferias_Item",
         column: "ferias_item_id",
         principalTable: "Ferias_Itens",
         principalColumn: "id",
         onDelete: ReferentialAction.Restrict);
 }
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_DraftedPlayers_Drafts_DraftId",
                schema: "ff",
                table: "DraftedPlayers");

            migrationBuilder.DropForeignKey(
                name: "FK_DraftedPlayers_Team_TeamId",
                schema: "ff",
                table: "DraftedPlayers");

            migrationBuilder.DropForeignKey(
                name: "FK_MatchupRosters_Team_TeamId",
                schema: "ff",
                table: "MatchupRosters");

            migrationBuilder.DropForeignKey(
                name: "FK_Seasons_Drafts_DraftId",
                schema: "ff",
                table: "Seasons");

            migrationBuilder.DropForeignKey(
                name: "FK_Team_Managers_ManagerId",
                schema: "ff",
                table: "Team");

            migrationBuilder.DropForeignKey(
                name: "FK_Team_Seasons_SeasonId",
                schema: "ff",
                table: "Team");

            migrationBuilder.DropIndex(
                name: "IX_Seasons_DraftId",
                schema: "ff",
                table: "Seasons");

            migrationBuilder.DropIndex(
                name: "IX_DraftedPlayers_DraftId",
                schema: "ff",
                table: "DraftedPlayers");

            migrationBuilder.DropPrimaryKey(
                name: "PK_Team",
                schema: "ff",
                table: "Team");

            migrationBuilder.DropColumn(
                name: "DraftId",
                schema: "ff",
                table: "Seasons");

            migrationBuilder.DropColumn(
                name: "DisplayPosition",
                schema: "ff",
                table: "NFLPlayers");

            migrationBuilder.DropColumn(
                name: "EligiblePositions",
                schema: "ff",
                table: "MatchupPlayers");

            migrationBuilder.DropColumn(
                name: "DraftId",
                schema: "ff",
                table: "DraftedPlayers");

            migrationBuilder.DropColumn(
                name: "LossesDivision",
                schema: "ff",
                table: "Team");

            migrationBuilder.DropColumn(
                name: "PlayoffSeed",
                schema: "ff",
                table: "Team");

            migrationBuilder.DropColumn(
                name: "TiesDivision",
                schema: "ff",
                table: "Team");

            migrationBuilder.DropColumn(
                name: "WinsDivision",
                schema: "ff",
                table: "Team");

            migrationBuilder.RenameTable(
                name: "Team",
                schema: "ff",
                newName: "ManagerSeasons",
                newSchema: "ff");

            migrationBuilder.RenameColumn(
                name: "PrimaryPosition",
                schema: "ff",
                table: "NFLPlayers",
                newName: "NFLPosition");

            migrationBuilder.RenameIndex(
                name: "IX_Team_SeasonId",
                schema: "ff",
                table: "ManagerSeasons",
                newName: "IX_ManagerSeasons_SeasonId");

            migrationBuilder.RenameIndex(
                name: "IX_Team_ManagerId",
                schema: "ff",
                table: "ManagerSeasons",
                newName: "IX_ManagerSeasons_ManagerId");

            migrationBuilder.AddColumn <int>(
                name: "YahooLeagueId",
                schema: "ff",
                table: "Seasons",
                type: "int",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn <int>(
                name: "YahooId",
                schema: "ff",
                table: "NFLPlayers",
                type: "int",
                nullable: true);

            migrationBuilder.AddColumn <string>(
                name: "SeasonId",
                schema: "ff",
                table: "Drafts",
                type: "nvarchar(450)",
                nullable: true);

            migrationBuilder.AddUniqueConstraint(
                name: "AK_Seasons_YahooLeagueId",
                schema: "ff",
                table: "Seasons",
                column: "YahooLeagueId");

            migrationBuilder.AddPrimaryKey(
                name: "PK_ManagerSeasons",
                schema: "ff",
                table: "ManagerSeasons",
                column: "TeamId");

            migrationBuilder.CreateIndex(
                name: "IX_Drafts_SeasonId",
                schema: "ff",
                table: "Drafts",
                column: "SeasonId",
                unique: true,
                filter: "[SeasonId] IS NOT NULL");

            migrationBuilder.AddForeignKey(
                name: "FK_DraftedPlayers_ManagerSeasons_TeamId",
                schema: "ff",
                table: "DraftedPlayers",
                column: "TeamId",
                principalSchema: "ff",
                principalTable: "ManagerSeasons",
                principalColumn: "TeamId",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Drafts_Seasons_SeasonId",
                schema: "ff",
                table: "Drafts",
                column: "SeasonId",
                principalSchema: "ff",
                principalTable: "Seasons",
                principalColumn: "SeasonId",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_ManagerSeasons_Managers_ManagerId",
                schema: "ff",
                table: "ManagerSeasons",
                column: "ManagerId",
                principalSchema: "ff",
                principalTable: "Managers",
                principalColumn: "ManagerId",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_ManagerSeasons_Seasons_SeasonId",
                schema: "ff",
                table: "ManagerSeasons",
                column: "SeasonId",
                principalSchema: "ff",
                principalTable: "Seasons",
                principalColumn: "SeasonId",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_MatchupRosters_ManagerSeasons_TeamId",
                schema: "ff",
                table: "MatchupRosters",
                column: "TeamId",
                principalSchema: "ff",
                principalTable: "ManagerSeasons",
                principalColumn: "TeamId",
                onDelete: ReferentialAction.Restrict);
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.RenameColumn(
                name: "UserId",
                table: "Service",
                newName: "VendorId");

            migrationBuilder.AddUniqueConstraint(
                name: "AK_Service_Id_VendorId",
                table: "Service",
                columns: new[] { "Id", "VendorId" });

            migrationBuilder.CreateTable(
                name: "AppUser",
                columns: table => new
            {
                AccessFailedCount    = table.Column <int>(nullable: false),
                EmailConfirmed       = table.Column <bool>(nullable: false),
                LockoutEnabled       = table.Column <bool>(nullable: false),
                LockoutEnd           = table.Column <DateTimeOffset>(nullable: true),
                PhoneNumberConfirmed = table.Column <bool>(nullable: false),
                TwoFactorEnabled     = table.Column <bool>(nullable: false),
                Id                 = table.Column <string>(nullable: false),
                UserName           = table.Column <string>(maxLength: 256, nullable: true),
                NormalizedUserName = table.Column <string>(maxLength: 256, nullable: true),
                Email              = table.Column <string>(maxLength: 256, nullable: true),
                NormalizedEmail    = table.Column <string>(maxLength: 256, nullable: true),
                PasswordHash       = table.Column <string>(nullable: true),
                SecurityStamp      = table.Column <string>(nullable: true),
                ConcurrencyStamp   = table.Column <string>(nullable: true),
                PhoneNumber        = table.Column <string>(nullable: true),
                FirstName          = table.Column <string>(nullable: true),
                LastName           = table.Column <string>(nullable: true),
                FacebookId         = table.Column <long>(nullable: true),
                GoogleId           = table.Column <long>(nullable: true),
                PictureUrl         = table.Column <string>(nullable: true),
                DateCreated        = table.Column <DateTime>(nullable: false),
                DateUpdated        = table.Column <DateTime>(nullable: false),
                LastLogin          = table.Column <DateTime>(nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_AppUser", x => x.Id);
            });

            migrationBuilder.CreateTable(
                name: "IdentityRole",
                columns: table => new
            {
                Id               = table.Column <string>(nullable: false),
                Name             = table.Column <string>(maxLength: 256, nullable: true),
                NormalizedName   = table.Column <string>(maxLength: 256, nullable: true),
                ConcurrencyStamp = table.Column <string>(nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_IdentityRole", x => x.Id);
            });

            migrationBuilder.CreateTable(
                name: "IdentityUserClaim",
                columns: table => new
            {
                Id = table.Column <int>(nullable: false)
                     .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                UserId     = table.Column <string>(nullable: false),
                ClaimType  = table.Column <string>(nullable: true),
                ClaimValue = table.Column <string>(nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_IdentityUserClaim", x => x.Id);
                table.ForeignKey(
                    name: "FK_IdentityUserClaim_AppUser_UserId",
                    column: x => x.UserId,
                    principalTable: "AppUser",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateTable(
                name: "IdentityUserLogin",
                columns: table => new
            {
                LoginProvider       = table.Column <string>(nullable: false),
                ProviderKey         = table.Column <string>(nullable: false),
                ProviderDisplayName = table.Column <string>(nullable: true),
                UserId = table.Column <string>(nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_IdentityUserLogin", x => new { x.LoginProvider, x.ProviderKey });
                table.ForeignKey(
                    name: "FK_IdentityUserLogin_AppUser_UserId",
                    column: x => x.UserId,
                    principalTable: "AppUser",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateTable(
                name: "IdentityUserToken",
                columns: table => new
            {
                UserId        = table.Column <string>(nullable: false),
                LoginProvider = table.Column <string>(nullable: false),
                Name          = table.Column <string>(nullable: false),
                Value         = table.Column <string>(nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_IdentityUserToken", x => new { x.UserId, x.LoginProvider, x.Name });
                table.ForeignKey(
                    name: "FK_IdentityUserToken_AppUser_UserId",
                    column: x => x.UserId,
                    principalTable: "AppUser",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateTable(
                name: "Vendor",
                columns: table => new
            {
                Id = table.Column <int>(nullable: false)
                     .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                IdentityId = table.Column <string>(nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_Vendor", x => x.Id);
                table.ForeignKey(
                    name: "FK_Vendor_AppUser_IdentityId",
                    column: x => x.IdentityId,
                    principalTable: "AppUser",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Restrict);
            });

            migrationBuilder.CreateTable(
                name: "IdentityRoleClaim",
                columns: table => new
            {
                Id = table.Column <int>(nullable: false)
                     .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                RoleId     = table.Column <string>(nullable: false),
                ClaimType  = table.Column <string>(nullable: true),
                ClaimValue = table.Column <string>(nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_IdentityRoleClaim", x => x.Id);
                table.ForeignKey(
                    name: "FK_IdentityRoleClaim_IdentityRole_RoleId",
                    column: x => x.RoleId,
                    principalTable: "IdentityRole",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateTable(
                name: "IdentityUserRole",
                columns: table => new
            {
                UserId = table.Column <string>(nullable: false),
                RoleId = table.Column <string>(nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_IdentityUserRole", x => new { x.UserId, x.RoleId });
                table.ForeignKey(
                    name: "FK_IdentityUserRole_IdentityRole_RoleId",
                    column: x => x.RoleId,
                    principalTable: "IdentityRole",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
                table.ForeignKey(
                    name: "FK_IdentityUserRole_AppUser_UserId",
                    column: x => x.UserId,
                    principalTable: "AppUser",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateIndex(
                name: "IX_Service_VendorId",
                table: "Service",
                column: "VendorId");

            migrationBuilder.CreateIndex(
                name: "EmailIndex",
                table: "AppUser",
                column: "NormalizedEmail");

            migrationBuilder.CreateIndex(
                name: "UserNameIndex",
                table: "AppUser",
                column: "NormalizedUserName",
                unique: true,
                filter: "[NormalizedUserName] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "RoleNameIndex",
                table: "IdentityRole",
                column: "NormalizedName",
                unique: true,
                filter: "[NormalizedName] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_IdentityRoleClaim_RoleId",
                table: "IdentityRoleClaim",
                column: "RoleId");

            migrationBuilder.CreateIndex(
                name: "IX_IdentityUserClaim_UserId",
                table: "IdentityUserClaim",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_IdentityUserLogin_UserId",
                table: "IdentityUserLogin",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_IdentityUserRole_RoleId",
                table: "IdentityUserRole",
                column: "RoleId");

            migrationBuilder.CreateIndex(
                name: "IX_Vendor_IdentityId",
                table: "Vendor",
                column: "IdentityId");

            migrationBuilder.AddForeignKey(
                name: "FK_Service_Vendor_VendorId",
                table: "Service",
                column: "VendorId",
                principalTable: "Vendor",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
Ejemplo n.º 7
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            //migrationBuilder.DropForeignKey(
            //    name: "FK_Candles_Pairs_ExchangePairId",
            //    table: "Candles");

            migrationBuilder.DropForeignKey(
                name: "FK_Candles_Pairs_PairId",
                table: "Candles");

            migrationBuilder.DropUniqueConstraint(
                name: "AK_Candles_TimeOpen_TimeClose_PairId",
                table: "Candles");

            migrationBuilder.DropIndex(
                name: "IX_Candles_PairId",
                table: "Candles");

            //migrationBuilder.DropColumn(
            //    name: "PairId",
            //    table: "Candles");

            migrationBuilder.AlterColumn <Guid>(
                name: "ExchangePairId",
                table: "Candles",
                nullable: false,
                oldClrType: typeof(Guid),
                oldType: "uuid",
                oldNullable: true);

            migrationBuilder.AddColumn <Guid>(
                name: "ExchangePairId1",
                table: "Candles",
                nullable: true);

            migrationBuilder.AddUniqueConstraint(
                name: "AK_Candles_TimeOpen_TimeClose_ExchangePairId",
                table: "Candles",
                columns: new[] { "TimeOpen", "TimeClose", "ExchangePairId" });

            migrationBuilder.CreateIndex(
                name: "IX_Candles_ExchangePairId1",
                table: "Candles",
                column: "ExchangePairId1");

            migrationBuilder.AddForeignKey(
                name: "FK_Candles_Pairs_ExchangePairId",
                table: "Candles",
                column: "ExchangePairId",
                principalTable: "Pairs",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_Candles_Pairs_ExchangePairId1",
                table: "Candles",
                column: "ExchangePairId1",
                principalTable: "Pairs",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
Ejemplo n.º 8
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_Tournament_WinnerId",
                table: "Tournament");

            migrationBuilder.DropIndex(
                name: "IX_Player_GameId_UserId",
                table: "Player");

            migrationBuilder.DropIndex(
                name: "IX_OpenIddictTokens_ApplicationId",
                table: "OpenIddictTokens");

            migrationBuilder.DropIndex(
                name: "IX_OpenIddictAuthorizations_ApplicationId",
                table: "OpenIddictAuthorizations");

            migrationBuilder.DropIndex(
                name: "IX_Channels_GameId",
                table: "Channels");

            migrationBuilder.DropIndex(
                name: "UserNameIndex",
                table: "AspNetUsers");

            migrationBuilder.DropPrimaryKey(
                name: "PK_AspNetUserLogins",
                table: "AspNetUserLogins");

            migrationBuilder.DropIndex(
                name: "IX_AspNetUserLogins_UserId",
                table: "AspNetUserLogins");

            migrationBuilder.DropIndex(
                name: "RoleNameIndex",
                table: "AspNetRoles");

            migrationBuilder.RenameColumn(
                name: "Scope",
                table: "OpenIddictAuthorizations",
                newName: "Scopes");

            migrationBuilder.RenameColumn(
                name: "RedirectUri",
                table: "OpenIddictApplications",
                newName: "RedirectUris");

            migrationBuilder.RenameColumn(
                name: "LogoutRedirectUri",
                table: "OpenIddictApplications",
                newName: "Properties");

            migrationBuilder.AlterColumn <string>(
                name: "Type",
                table: "OpenIddictTokens",
                maxLength: 25,
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Subject",
                table: "OpenIddictTokens",
                maxLength: 450,
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AddColumn <string>(
                name: "ConcurrencyToken",
                table: "OpenIddictTokens",
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn <DateTimeOffset>(
                name: "CreationDate",
                table: "OpenIddictTokens",
                nullable: true);

            migrationBuilder.AddColumn <DateTimeOffset>(
                name: "ExpirationDate",
                table: "OpenIddictTokens",
                nullable: true);

            migrationBuilder.AddColumn <string>(
                name: "Payload",
                table: "OpenIddictTokens",
                nullable: true);

            migrationBuilder.AddColumn <string>(
                name: "Properties",
                table: "OpenIddictTokens",
                nullable: true);

            migrationBuilder.AddColumn <string>(
                name: "ReferenceId",
                table: "OpenIddictTokens",
                maxLength: 100,
                nullable: true);

            migrationBuilder.AddColumn <string>(
                name: "Status",
                table: "OpenIddictTokens",
                maxLength: 25,
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn <string>(
                name: "ConcurrencyToken",
                table: "OpenIddictScopes",
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn <string>(
                name: "DisplayName",
                table: "OpenIddictScopes",
                nullable: true);

            migrationBuilder.AddColumn <string>(
                name: "Name",
                table: "OpenIddictScopes",
                maxLength: 200,
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn <string>(
                name: "Properties",
                table: "OpenIddictScopes",
                nullable: true);

            migrationBuilder.AddColumn <string>(
                name: "Resources",
                table: "OpenIddictScopes",
                nullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Subject",
                table: "OpenIddictAuthorizations",
                maxLength: 450,
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AddColumn <string>(
                name: "ConcurrencyToken",
                table: "OpenIddictAuthorizations",
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn <string>(
                name: "Properties",
                table: "OpenIddictAuthorizations",
                nullable: true);

            migrationBuilder.AddColumn <string>(
                name: "Status",
                table: "OpenIddictAuthorizations",
                maxLength: 25,
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn <string>(
                name: "Type",
                table: "OpenIddictAuthorizations",
                maxLength: 25,
                nullable: false,
                defaultValue: "");

            migrationBuilder.AlterColumn <string>(
                name: "Type",
                table: "OpenIddictApplications",
                maxLength: 25,
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "ClientId",
                table: "OpenIddictApplications",
                maxLength: 100,
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AddColumn <string>(
                name: "ConcurrencyToken",
                table: "OpenIddictApplications",
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn <string>(
                name: "ConsentType",
                table: "OpenIddictApplications",
                nullable: true);

            migrationBuilder.AddColumn <string>(
                name: "Permissions",
                table: "OpenIddictApplications",
                nullable: true);

            migrationBuilder.AddColumn <string>(
                name: "PostLogoutRedirectUris",
                table: "OpenIddictApplications",
                nullable: true);

            migrationBuilder.AddUniqueConstraint(
                name: "AK_AspNetUserLogins_LoginProvider_ProviderKey",
                table: "AspNetUserLogins",
                columns: new[] { "LoginProvider", "ProviderKey" });

            migrationBuilder.AddPrimaryKey(
                name: "PK_AspNetUserLogins",
                table: "AspNetUserLogins",
                columns: new[] { "UserId", "LoginProvider" });

            migrationBuilder.CreateIndex(
                name: "IX_Tournament_WinnerId",
                table: "Tournament",
                column: "WinnerId",
                unique: true,
                filter: "[WinnerId] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_Player_GameId_UserId",
                table: "Player",
                columns: new[] { "GameId", "UserId" },
                unique: true,
                filter: "[GameId] IS NOT NULL AND [UserId] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_OpenIddictTokens_ReferenceId",
                table: "OpenIddictTokens",
                column: "ReferenceId",
                unique: true,
                filter: "[ReferenceId] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_OpenIddictTokens_ApplicationId_Status_Subject_Type",
                table: "OpenIddictTokens",
                columns: new[] { "ApplicationId", "Status", "Subject", "Type" });

            migrationBuilder.CreateIndex(
                name: "IX_OpenIddictScopes_Name",
                table: "OpenIddictScopes",
                column: "Name",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_OpenIddictAuthorizations_ApplicationId_Status_Subject_Type",
                table: "OpenIddictAuthorizations",
                columns: new[] { "ApplicationId", "Status", "Subject", "Type" });

            migrationBuilder.CreateIndex(
                name: "IX_Channels_GameId",
                table: "Channels",
                column: "GameId",
                unique: true,
                filter: "[GameId] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "UserNameIndex",
                table: "AspNetUsers",
                column: "NormalizedUserName",
                unique: true,
                filter: "[NormalizedUserName] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "RoleNameIndex",
                table: "AspNetRoles",
                column: "NormalizedName",
                unique: true,
                filter: "[NormalizedName] IS NOT NULL");

            migrationBuilder.AddForeignKey(
                name: "FK_AspNetUserTokens_AspNetUsers_UserId",
                table: "AspNetUserTokens",
                column: "UserId",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
Ejemplo n.º 9
0
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_PharmacyPrescriptions",
                schema: "an",
                table: "PharmacyPrescriptions");

            migrationBuilder.DropIndex(
                name: "IX_PharmacyPrescriptions_PharmacyId",
                schema: "an",
                table: "PharmacyPrescriptions");

            migrationBuilder.DropIndex(
                name: "IX_PharmacyPrescriptions_TreatmentHistoryId",
                schema: "an",
                table: "PharmacyPrescriptions");

            migrationBuilder.DropColumn(
                name: "Id",
                schema: "an",
                table: "PharmacyPrescriptions");

            migrationBuilder.AddUniqueConstraint(
                name: "AK_PharmacyPrescriptions_PharmacyId_TreatmentHistoryId",
                schema: "an",
                table: "PharmacyPrescriptions",
                columns: new[] { "PharmacyId", "TreatmentHistoryId" });

            migrationBuilder.AddPrimaryKey(
                name: "PK_PharmacyPrescriptions",
                schema: "an",
                table: "PharmacyPrescriptions",
                columns: new[] { "TreatmentHistoryId", "PharmacyId" });

            migrationBuilder.UpdateData(
                schema: "an",
                table: "City",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 684, DateTimeKind.Local).AddTicks(8125));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "City",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 684, DateTimeKind.Local).AddTicks(8156));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "City",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 684, DateTimeKind.Local).AddTicks(8159));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Expertise",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 686, DateTimeKind.Local).AddTicks(453));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Expertise",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 686, DateTimeKind.Local).AddTicks(475));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "ExpertiseCategory",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(6739));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "ExpertiseCategory",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(8242));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Province",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 684, DateTimeKind.Local).AddTicks(1104));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Province",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 684, DateTimeKind.Local).AddTicks(1744));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Province",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 684, DateTimeKind.Local).AddTicks(1747));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "ScientificCategory",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(4305));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "ScientificCategory",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(5850));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "ScientificCategory",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(5864));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3194));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3388));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3390));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 4,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3392));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 5,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3393));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 6,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3418));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 7,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3420));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 8,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3422));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 9,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3423));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 10,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3425));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 11,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3426));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 12,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3428));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 13,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3430));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 14,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3431));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 15,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3434));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 16,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3436));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 17,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3461));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 18,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3463));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 19,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3474));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 20,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3476));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 21,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3486));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 22,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3487));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 23,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3489));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 24,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3490));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 25,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3492));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 26,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3494));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 27,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3495));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 28,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3497));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 29,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3498));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 30,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3500));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 31,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3501));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 32,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3503));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 33,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3515));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 34,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3516));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 35,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3527));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 36,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3529));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 37,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3531));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 38,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3532));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 39,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3543));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "Service",
                keyColumn: "Id",
                keyValue: 40,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(3544));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "ServiceCategory",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(712));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "ServiceCategory",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(735));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "ServiceCategory",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(738));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "ServiceCategory",
                keyColumn: "Id",
                keyValue: 4,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(739));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "ServiceCategory",
                keyColumn: "Id",
                keyValue: 5,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(741));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "ServiceCategory",
                keyColumn: "Id",
                keyValue: 6,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(743));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "ServiceCategory",
                keyColumn: "Id",
                keyValue: 7,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(744));

            migrationBuilder.UpdateData(
                schema: "an",
                table: "ServiceCategory",
                keyColumn: "Id",
                keyValue: 8,
                column: "CreatedAt",
                value: new DateTime(2019, 12, 3, 12, 9, 59, 685, DateTimeKind.Local).AddTicks(746));
        }
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Groups_Rooms_RoomId",
                table: "Groups");

            migrationBuilder.DropForeignKey(
                name: "FK_RoomParticipants_Rooms_RoomId",
                table: "RoomParticipants");

            migrationBuilder.DropForeignKey(
                name: "FK_RoomParticipants_Users_UserId",
                table: "RoomParticipants");

            migrationBuilder.DropUniqueConstraint(
                name: "AK_RoomParticipants_RoomId_UserId",
                table: "RoomParticipants");

            migrationBuilder.DropPrimaryKey(
                name: "PK_RoomParticipants",
                table: "RoomParticipants");

            migrationBuilder.DropPrimaryKey(
                name: "PK_Groups",
                table: "Groups");

            migrationBuilder.RenameTable(
                name: "RoomParticipants",
                newName: "RoomParticipant");

            migrationBuilder.RenameTable(
                name: "Groups",
                newName: "Group");

            migrationBuilder.RenameIndex(
                name: "IX_Groups_RoomId",
                table: "Group",
                newName: "IX_Group_RoomId");

            migrationBuilder.AddUniqueConstraint(
                name: "AK_RoomParticipant_RoomId_UserId",
                table: "RoomParticipant",
                columns: new[] { "RoomId", "UserId" });

            migrationBuilder.AddPrimaryKey(
                name: "PK_RoomParticipant",
                table: "RoomParticipant",
                columns: new[] { "UserId", "RoomId" });

            migrationBuilder.AddPrimaryKey(
                name: "PK_Group",
                table: "Group",
                column: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_Group_Rooms_RoomId",
                table: "Group",
                column: "RoomId",
                principalTable: "Rooms",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_RoomParticipant_Rooms_RoomId",
                table: "RoomParticipant",
                column: "RoomId",
                principalTable: "Rooms",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_RoomParticipant_Users_UserId",
                table: "RoomParticipant",
                column: "UserId",
                principalTable: "Users",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
Ejemplo n.º 11
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_LessonPlan_ArtPiece_ArtPieces_ArtPieceId",
                table: "LessonPlan_ArtPiece");

            migrationBuilder.DropForeignKey(
                name: "FK_LessonPlan_ArtPiece_Lessonplans_LessonPlanId",
                table: "LessonPlan_ArtPiece");

            migrationBuilder.DropForeignKey(
                name: "FK_LessonPlan_Poem_Lessonplans_LessonPlanId",
                table: "LessonPlan_Poem");

            migrationBuilder.DropForeignKey(
                name: "FK_LessonPlan_Poem_Poems_PoemId",
                table: "LessonPlan_Poem");

            migrationBuilder.DropForeignKey(
                name: "FK_LessonPlan_WritingAssignment_Lessonplans_LessonPlanId",
                table: "LessonPlan_WritingAssignment");

            migrationBuilder.DropForeignKey(
                name: "FK_LessonPlan_WritingAssignment_WritingAssignments_WritingAssignmentId",
                table: "LessonPlan_WritingAssignment");

            migrationBuilder.DropPrimaryKey(
                name: "PK_LessonPlan_WritingAssignment",
                table: "LessonPlan_WritingAssignment");

            migrationBuilder.DropUniqueConstraint(
                name: "AK_LessonPlan_WritingAssignment_WritingAssignmentId_LessonPlanId",
                table: "LessonPlan_WritingAssignment");

            migrationBuilder.DropPrimaryKey(
                name: "PK_LessonPlan_Poem",
                table: "LessonPlan_Poem");

            migrationBuilder.DropPrimaryKey(
                name: "PK_LessonPlan_ArtPiece",
                table: "LessonPlan_ArtPiece");

            migrationBuilder.RenameTable(
                name: "LessonPlan_WritingAssignment",
                newName: "lessonPlan_WritingAssignments");

            migrationBuilder.RenameTable(
                name: "LessonPlan_Poem",
                newName: "lessonPlan_Poems");

            migrationBuilder.RenameTable(
                name: "LessonPlan_ArtPiece",
                newName: "lessonPlan_ArtPieces");

            migrationBuilder.RenameIndex(
                name: "IX_LessonPlan_Poem_PoemId",
                table: "lessonPlan_Poems",
                newName: "IX_lessonPlan_Poems_PoemId");

            migrationBuilder.RenameIndex(
                name: "IX_LessonPlan_ArtPiece_LessonPlanId",
                table: "lessonPlan_ArtPieces",
                newName: "IX_lessonPlan_ArtPieces_LessonPlanId");

            migrationBuilder.AddColumn <int>(
                name: "LessonPlanId",
                table: "WritingAssignments",
                nullable: true);

            migrationBuilder.AddColumn <int>(
                name: "LessonPlanId",
                table: "Poems",
                nullable: true);

            migrationBuilder.AddColumn <int>(
                name: "LessonPlanId",
                table: "ArtPieces",
                nullable: true);

            migrationBuilder.AddPrimaryKey(
                name: "PK_lessonPlan_WritingAssignments",
                table: "lessonPlan_WritingAssignments",
                columns: new[] { "LessonPlanId", "WritingAssignmentId" });

            migrationBuilder.AddUniqueConstraint(
                name: "AK_lessonPlan_WritingAssignments_WritingAssignmentId_LessonPlanId",
                table: "lessonPlan_WritingAssignments",
                columns: new[] { "WritingAssignmentId", "LessonPlanId" });

            migrationBuilder.AddPrimaryKey(
                name: "PK_lessonPlan_Poems",
                table: "lessonPlan_Poems",
                columns: new[] { "LessonPlanId", "PoemId" });

            migrationBuilder.AddPrimaryKey(
                name: "PK_lessonPlan_ArtPieces",
                table: "lessonPlan_ArtPieces",
                columns: new[] { "ArtPieceId", "LessonPlanId" });

            migrationBuilder.CreateIndex(
                name: "IX_WritingAssignments_LessonPlanId",
                table: "WritingAssignments",
                column: "LessonPlanId");

            migrationBuilder.CreateIndex(
                name: "IX_Poems_LessonPlanId",
                table: "Poems",
                column: "LessonPlanId");

            migrationBuilder.CreateIndex(
                name: "IX_ArtPieces_LessonPlanId",
                table: "ArtPieces",
                column: "LessonPlanId");

            migrationBuilder.AddForeignKey(
                name: "FK_ArtPieces_Lessonplans_LessonPlanId",
                table: "ArtPieces",
                column: "LessonPlanId",
                principalTable: "Lessonplans",
                principalColumn: "LessonPlanId",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_lessonPlan_ArtPieces_ArtPieces_ArtPieceId",
                table: "lessonPlan_ArtPieces",
                column: "ArtPieceId",
                principalTable: "ArtPieces",
                principalColumn: "ArtPieceId",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_lessonPlan_ArtPieces_Lessonplans_LessonPlanId",
                table: "lessonPlan_ArtPieces",
                column: "LessonPlanId",
                principalTable: "Lessonplans",
                principalColumn: "LessonPlanId",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_lessonPlan_Poems_Lessonplans_LessonPlanId",
                table: "lessonPlan_Poems",
                column: "LessonPlanId",
                principalTable: "Lessonplans",
                principalColumn: "LessonPlanId",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_lessonPlan_Poems_Poems_PoemId",
                table: "lessonPlan_Poems",
                column: "PoemId",
                principalTable: "Poems",
                principalColumn: "PoemId",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_lessonPlan_WritingAssignments_Lessonplans_LessonPlanId",
                table: "lessonPlan_WritingAssignments",
                column: "LessonPlanId",
                principalTable: "Lessonplans",
                principalColumn: "LessonPlanId",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_lessonPlan_WritingAssignments_WritingAssignments_WritingAssignmentId",
                table: "lessonPlan_WritingAssignments",
                column: "WritingAssignmentId",
                principalTable: "WritingAssignments",
                principalColumn: "WritingAssignmentId",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_Poems_Lessonplans_LessonPlanId",
                table: "Poems",
                column: "LessonPlanId",
                principalTable: "Lessonplans",
                principalColumn: "LessonPlanId",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_WritingAssignments_Lessonplans_LessonPlanId",
                table: "WritingAssignments",
                column: "LessonPlanId",
                principalTable: "Lessonplans",
                principalColumn: "LessonPlanId",
                onDelete: ReferentialAction.Restrict);
        }
Ejemplo n.º 12
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropUniqueConstraint(
                name: "AK_TradePoolMaster_BidPrice_BuyServiceID_Id_SellServiceID",
                table: "TradePoolMaster");

            migrationBuilder.DropColumn(
                name: "RoutID",
                table: "TransactionQueue");

            migrationBuilder.AlterColumn <long>(
                name: "ProductID",
                table: "TransactionQueue",
                nullable: false,
                oldClrType: typeof(int));

            migrationBuilder.AddColumn <long>(
                name: "RouteID",
                table: "TransactionQueue",
                nullable: false,
                defaultValue: 0L);

            migrationBuilder.AddColumn <long>(
                name: "CountPerPrice",
                table: "TradePoolMaster",
                nullable: false,
                defaultValue: 0L);

            migrationBuilder.AlterColumn <long>(
                name: "CountryID",
                table: "StateMaster",
                nullable: false,
                oldClrType: typeof(string));

            migrationBuilder.AddUniqueConstraint(
                name: "AK_TradePoolMaster_BidPrice_BuyServiceID_CountPerPrice_Id_SellServiceID",
                table: "TradePoolMaster",
                columns: new[] { "BidPrice", "BuyServiceID", "CountPerPrice", "Id", "SellServiceID" });

            migrationBuilder.CreateTable(
                name: "CityMaster",
                columns: table => new
            {
                Id = table.Column <long>(nullable: false)
                     .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                CreatedDate = table.Column <DateTime>(nullable: false),
                CreatedBy   = table.Column <long>(nullable: false),
                UpdatedBy   = table.Column <long>(nullable: true),
                UpdatedDate = table.Column <DateTime>(nullable: false),
                Status      = table.Column <short>(nullable: false),
                CityName    = table.Column <string>(maxLength: 30, nullable: false),
                StateID     = table.Column <long>(nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_CityMaster", x => x.Id);
            });

            migrationBuilder.CreateTable(
                name: "DepositCounterLog",
                columns: table => new
            {
                Id = table.Column <long>(nullable: false)
                     .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                CreatedDate            = table.Column <DateTime>(nullable: false),
                CreatedBy              = table.Column <long>(nullable: false),
                UpdatedBy              = table.Column <long>(nullable: true),
                UpdatedDate            = table.Column <DateTime>(nullable: false),
                Status                 = table.Column <short>(nullable: false),
                NewTxnID               = table.Column <string>(nullable: true),
                PreviousTrnID          = table.Column <string>(nullable: true),
                LastTrnID              = table.Column <string>(nullable: true),
                LastLimit              = table.Column <long>(nullable: false),
                NextBatchPrvID         = table.Column <string>(nullable: true),
                DepositCounterMasterId = table.Column <long>(nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_DepositCounterLog", x => x.Id);
            });

            migrationBuilder.CreateTable(
                name: "DepositCounterMaster",
                columns: table => new
            {
                Id = table.Column <long>(nullable: false)
                     .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                CreatedDate     = table.Column <DateTime>(nullable: false),
                CreatedBy       = table.Column <long>(nullable: false),
                UpdatedBy       = table.Column <long>(nullable: true),
                UpdatedDate     = table.Column <DateTime>(nullable: false),
                Status          = table.Column <short>(nullable: false),
                RecordCount     = table.Column <int>(nullable: false),
                Limit           = table.Column <long>(nullable: false),
                LastTrnID       = table.Column <string>(nullable: true),
                MaxLimit        = table.Column <long>(nullable: false),
                WalletTypeID    = table.Column <long>(nullable: false),
                SerProId        = table.Column <long>(nullable: false),
                PreviousTrnID   = table.Column <string>(nullable: true),
                TPSPickupStatus = table.Column <long>(nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_DepositCounterMaster", x => x.Id);
            });

            migrationBuilder.CreateTable(
                name: "ZipCodeMaster",
                columns: table => new
            {
                Id = table.Column <long>(nullable: false)
                     .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                CreatedDate = table.Column <DateTime>(nullable: false),
                CreatedBy   = table.Column <long>(nullable: false),
                UpdatedBy   = table.Column <long>(nullable: true),
                UpdatedDate = table.Column <DateTime>(nullable: false),
                Status      = table.Column <short>(nullable: false),
                ZipCode     = table.Column <long>(nullable: false),
                ZipAreaName = table.Column <string>(maxLength: 30, nullable: false),
                CityID      = table.Column <long>(nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_ZipCodeMaster", x => x.Id);
            });
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn <string>(
                name: "UserName",
                table: "AspNetUsers",
                maxLength: 256,
                nullable: false,
                oldClrType: typeof(string),
                oldMaxLength: 256,
                oldNullable: true);

            migrationBuilder.AddColumn <string>(
                name: "City",
                table: "AspNetUsers",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn <string>(
                name: "Country",
                table: "AspNetUsers",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn <string>(
                name: "FirstName",
                table: "AspNetUsers",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn <bool>(
                name: "IsAdmin",
                table: "AspNetUsers",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn <string>(
                name: "LastName",
                table: "AspNetUsers",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn <long>(
                name: "MobileNumber",
                table: "AspNetUsers",
                nullable: false,
                defaultValue: 0L);

            migrationBuilder.AddColumn <string>(
                name: "Password",
                table: "AspNetUsers",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn <string>(
                name: "PostalCode",
                table: "AspNetUsers",
                maxLength: 6,
                nullable: true);

            migrationBuilder.AddColumn <string>(
                name: "Province",
                table: "AspNetUsers",
                maxLength: 2,
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn <string>(
                name: "Street",
                table: "AspNetUsers",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn <DateTime>(
                name: "CreationDate",
                table: "AspNetRoles",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn <string>(
                name: "Description",
                table: "AspNetRoles",
                nullable: true);

            migrationBuilder.AddUniqueConstraint(
                name: "AK_AspNetUsers_UserName",
                table: "AspNetUsers",
                column: "UserName");
        }
Ejemplo n.º 14
0
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_MovieActors_ActorId",
                table: "MovieActors");

            migrationBuilder.DeleteData(
                table: "MovieActors",
                keyColumns: new[] { "MovieId", "ActorId" },
                keyValues: new object[] { 1, 1 });

            migrationBuilder.DeleteData(
                table: "MovieActors",
                keyColumns: new[] { "MovieId", "ActorId" },
                keyValues: new object[] { 2, 2 });

            migrationBuilder.DeleteData(
                table: "Actors",
                keyColumn: "Id",
                keyValue: 1);

            migrationBuilder.DeleteData(
                table: "Actors",
                keyColumn: "Id",
                keyValue: 2);

            migrationBuilder.DeleteData(
                table: "Movies",
                keyColumn: "Id",
                keyValue: 1);

            migrationBuilder.DeleteData(
                table: "Movies",
                keyColumn: "Id",
                keyValue: 2);

            migrationBuilder.AlterColumn <decimal>(
                name: "Id",
                table: "Movies",
                type: "decimal(20,0)",
                nullable: false,
                oldClrType: typeof(int))
            .Annotation("SqlServer:Identity", "1, 1")
            .OldAnnotation("SqlServer:Identity", "1, 1");

            migrationBuilder.AlterColumn <decimal>(
                name: "ActorId",
                table: "MovieActors",
                type: "decimal(20,0)",
                nullable: false,
                oldClrType: typeof(int));

            migrationBuilder.AlterColumn <decimal>(
                name: "MovieId",
                table: "MovieActors",
                type: "decimal(20,0)",
                nullable: false,
                oldClrType: typeof(int));

            migrationBuilder.AlterColumn <decimal>(
                name: "Id",
                table: "Actors",
                type: "decimal(20,0)",
                nullable: false,
                oldClrType: typeof(int))
            .Annotation("SqlServer:Identity", "1, 1")
            .OldAnnotation("SqlServer:Identity", "1, 1");

            migrationBuilder.AddColumn <decimal>(
                name: "MovieId",
                table: "Actors",
                type: "decimal(20,0)",
                nullable: true);

            migrationBuilder.AddUniqueConstraint(
                name: "AK_MovieActors_ActorId_MovieId",
                table: "MovieActors",
                columns: new[] { "ActorId", "MovieId" });

            migrationBuilder.InsertData(
                table: "Actors",
                columns: new[] { "Id", "FirstName", "LastName", "MovieId" },
                values: new object[] { 1m, "Samuel L.", "Jackson", null });

            migrationBuilder.InsertData(
                table: "Movies",
                columns: new[] { "Id", "Name" },
                values: new object[] { 1m, "Pulp Fiction" });

            migrationBuilder.InsertData(
                table: "MovieActors",
                columns: new[] { "MovieId", "ActorId" },
                values: new object[] { 1m, 1m });

            migrationBuilder.CreateIndex(
                name: "IX_Actors_MovieId",
                table: "Actors",
                column: "MovieId");

            migrationBuilder.AddForeignKey(
                name: "FK_Actors_Movies_MovieId",
                table: "Actors",
                column: "MovieId",
                principalTable: "Movies",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
Ejemplo n.º 15
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_Cars",
                table: "Cars");

            migrationBuilder.RenameTable(
                name: "Cars",
                newName: "Car");

            migrationBuilder.RenameColumn(
                name: "Id",
                table: "Car",
                newName: "CarId");

            migrationBuilder.AlterColumn <string>(
                name: "PlateNo",
                table: "Car",
                maxLength: 30,
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Color",
                table: "Car",
                maxLength: 30,
                nullable: true,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "BuildNo",
                table: "Car",
                maxLength: 30,
                nullable: true,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AddPrimaryKey(
                name: "PK_Car",
                table: "Car",
                column: "CarId");

            migrationBuilder.AddUniqueConstraint(
                name: "AK_Car_PlateNo",
                table: "Car",
                column: "PlateNo");

            migrationBuilder.CreateIndex(
                name: "UX_Car_BuildNo",
                table: "Car",
                column: "BuildNo",
                unique: true,
                filter: "[BuildNo] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_Car_CarId",
                table: "Car",
                column: "CarId");

            migrationBuilder.CreateIndex(
                name: "UX_Car_PlateNo",
                table: "Car",
                column: "PlateNo",
                unique: true);
        }
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_SectionMemberships_Sections_SectionId",
                table: "SectionMemberships");

            migrationBuilder.DropIndex(
                name: "IX_Users_UniqueId",
                table: "Users");

            migrationBuilder.DropIndex(
                name: "IX_SectionMemberships_SectionId",
                table: "SectionMemberships");

            migrationBuilder.DropIndex(
                name: "IX_SectionMemberships_ClassroomMembershipId_SectionId",
                table: "SectionMemberships");

            migrationBuilder.DropIndex(
                name: "IX_ClassroomMemberships_UserId_ClassroomId",
                table: "ClassroomMemberships");

            migrationBuilder.DropIndex(
                name: "IX_QuestionCategories_ClassroomId_Name",
                table: "QuestionCategories");

            migrationBuilder.DropIndex(
                name: "IX_Questions_QuestionCategoryId_Name",
                table: "Questions");

            migrationBuilder.DropIndex(
                name: "IX_Sections_ClassroomId_Name",
                table: "Sections");

            migrationBuilder.DropIndex(
                name: "IX_Classrooms_Name",
                table: "Classrooms");

            migrationBuilder.DropColumn(
                name: "IsPrivate",
                table: "QuestionCategories");

            migrationBuilder.DropColumn(
                name: "AllowPartialCredit",
                table: "Questions");

            migrationBuilder.DropColumn(
                name: "IsPrivate",
                table: "Questions");

            migrationBuilder.DropColumn(
                name: "DateModified",
                table: "Questions");

            migrationBuilder.DropColumn(
                name: "FullGeneratorFileContents",
                table: "Questions");

            migrationBuilder.DropColumn(
                name: "FullGeneratorFileLineOffset",
                table: "Questions");

            migrationBuilder.DropTable(
                name: "UserQuestionSubmission");

            migrationBuilder.DropTable(
                name: "UserQuestionData");

            migrationBuilder.AddColumn<bool>(
                name: "RandomizeAnswers",
                table: "Questions",
                nullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "UniqueId",
                table: "Users",
                nullable: false);

            migrationBuilder.AddUniqueConstraint(
                name: "AK_Users_UniqueId",
                table: "Users",
                column: "UniqueId");

            migrationBuilder.AddUniqueConstraint(
                name: "AK_SectionMemberships_ClassroomMembershipId_SectionId",
                table: "SectionMemberships",
                columns: new[] { "ClassroomMembershipId", "SectionId" });

            migrationBuilder.AddUniqueConstraint(
                name: "AK_ClassroomMemberships_UserId_ClassroomId",
                table: "ClassroomMemberships",
                columns: new[] { "UserId", "ClassroomId" });

            migrationBuilder.AddUniqueConstraint(
                name: "AK_QuestionCategories_ClassroomId_Name",
                table: "QuestionCategories",
                columns: new[] { "ClassroomId", "Name" });

            migrationBuilder.AddUniqueConstraint(
                name: "AK_Questions_QuestionCategoryId_Name",
                table: "Questions",
                columns: new[] { "QuestionCategoryId", "Name" });

            migrationBuilder.AddUniqueConstraint(
                name: "AK_Sections_ClassroomId_Name",
                table: "Sections",
                columns: new[] { "ClassroomId", "Name" });

            migrationBuilder.AddUniqueConstraint(
                name: "AK_Classrooms_Name",
                table: "Classrooms",
                column: "Name");
        }
Ejemplo n.º 17
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddUniqueConstraint(
                name: "ak_player_user_id",
                table: "player",
                column: "user_id");

            migrationBuilder.CreateTable(
                name: "round",
                columns: table => new
            {
                round_id = table.Column <int>(type: "integer", nullable: false)
                           .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_round", x => x.round_id);
            });

            migrationBuilder.CreateTable(
                name: "admin_log",
                columns: table => new
            {
                admin_log_id = table.Column <int>(type: "integer", nullable: false)
                               .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                round_id = table.Column <int>(type: "integer", nullable: false),
                type     = table.Column <int>(type: "integer", nullable: false),
                date     = table.Column <DateTime>(type: "timestamp with time zone", nullable: false),
                message  = table.Column <string>(type: "text", nullable: false),
                json     = table.Column <JsonDocument>(type: "jsonb", nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_admin_log", x => new { x.admin_log_id, x.round_id });
                table.ForeignKey(
                    name: "FK_admin_log_round_round_id",
                    column: x => x.round_id,
                    principalTable: "round",
                    principalColumn: "round_id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateTable(
                name: "player_round",
                columns: table => new
            {
                players_id = table.Column <int>(type: "integer", nullable: false),
                rounds_id  = table.Column <int>(type: "integer", nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_player_round", x => new { x.players_id, x.rounds_id });
                table.ForeignKey(
                    name: "FK_player_round_player_players_id",
                    column: x => x.players_id,
                    principalTable: "player",
                    principalColumn: "player_id",
                    onDelete: ReferentialAction.Cascade);
                table.ForeignKey(
                    name: "FK_player_round_round_rounds_id",
                    column: x => x.rounds_id,
                    principalTable: "round",
                    principalColumn: "round_id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateTable(
                name: "admin_log_entity",
                columns: table => new
            {
                uid = table.Column <int>(type: "integer", nullable: false)
                      .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                name               = table.Column <string>(type: "text", nullable: true),
                admin_log_id       = table.Column <int>(type: "integer", nullable: true),
                admin_log_round_id = table.Column <int>(type: "integer", nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_admin_log_entity", x => x.uid);
                table.ForeignKey(
                    name: "FK_admin_log_entity_admin_log_admin_log_id_admin_log_round_id",
                    columns: x => new { x.admin_log_id, x.admin_log_round_id },
                    principalTable: "admin_log",
                    principalColumns: new[] { "admin_log_id", "round_id" });
            });

            migrationBuilder.CreateTable(
                name: "admin_log_player",
                columns: table => new
            {
                player_user_id = table.Column <Guid>(type: "uuid", nullable: false),
                log_id         = table.Column <int>(type: "integer", nullable: false),
                round_id       = table.Column <int>(type: "integer", nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_admin_log_player", x => new { x.player_user_id, x.log_id, x.round_id });
                table.ForeignKey(
                    name: "FK_admin_log_player_admin_log_log_id_round_id",
                    columns: x => new { x.log_id, x.round_id },
                    principalTable: "admin_log",
                    principalColumns: new[] { "admin_log_id", "round_id" },
                    onDelete: ReferentialAction.Cascade);
                table.ForeignKey(
                    name: "FK_admin_log_player_player_player_user_id",
                    column: x => x.player_user_id,
                    principalTable: "player",
                    principalColumn: "user_id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateIndex(
                name: "IX_admin_log_round_id",
                table: "admin_log",
                column: "round_id");

            migrationBuilder.CreateIndex(
                name: "IX_admin_log_type",
                table: "admin_log",
                column: "type");

            migrationBuilder.CreateIndex(
                name: "IX_admin_log_entity_admin_log_id_admin_log_round_id",
                table: "admin_log_entity",
                columns: new[] { "admin_log_id", "admin_log_round_id" });

            migrationBuilder.CreateIndex(
                name: "IX_admin_log_player_log_id_round_id",
                table: "admin_log_player",
                columns: new[] { "log_id", "round_id" });

            migrationBuilder.CreateIndex(
                name: "IX_player_round_rounds_id",
                table: "player_round",
                column: "rounds_id");
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "MarkFromUserToConpany",
                table: "Ratings");

            migrationBuilder.AlterColumn <DateTime>(
                name: "SendingDateTime",
                table: "Requests",
                nullable: true,
                oldClrType: typeof(DateTime),
                oldType: "datetime2");

            migrationBuilder.AlterColumn <DateTime>(
                name: "ReceivingDateTime",
                table: "Requests",
                nullable: true,
                oldClrType: typeof(DateTime),
                oldType: "datetime2");

            migrationBuilder.AlterColumn <int>(
                name: "CurrentLongitude",
                table: "Requests",
                nullable: true,
                oldClrType: typeof(int),
                oldType: "int");

            migrationBuilder.AlterColumn <int>(
                name: "CurrentLatitude",
                table: "Requests",
                nullable: true,
                oldClrType: typeof(int),
                oldType: "int");

            migrationBuilder.AlterColumn <int>(
                name: "MarkFromCompanyToUser",
                table: "Ratings",
                nullable: true,
                oldClrType: typeof(int),
                oldType: "int");

            migrationBuilder.AddColumn <int>(
                name: "MarkFromUserToCompany",
                table: "Ratings",
                nullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Series",
                table: "Passports",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)");

            migrationBuilder.AlterColumn <string>(
                name: "Number",
                table: "Passports",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)");

            migrationBuilder.AlterColumn <DateTime>(
                name: "IssuedDate",
                table: "Passports",
                nullable: true,
                oldClrType: typeof(DateTime),
                oldType: "datetime2");

            migrationBuilder.AlterColumn <DateTime>(
                name: "BirthDate",
                table: "Passports",
                nullable: true,
                oldClrType: typeof(DateTime),
                oldType: "datetime2");

            migrationBuilder.AlterColumn <float>(
                name: "Width",
                table: "Goods",
                nullable: true,
                oldClrType: typeof(float),
                oldType: "real");

            migrationBuilder.AlterColumn <float>(
                name: "Weight",
                table: "Goods",
                nullable: true,
                oldClrType: typeof(float),
                oldType: "real");

            migrationBuilder.AlterColumn <float>(
                name: "Length",
                table: "Goods",
                nullable: true,
                oldClrType: typeof(float),
                oldType: "real");

            migrationBuilder.AlterColumn <bool>(
                name: "IsFragile",
                table: "Goods",
                nullable: true,
                oldClrType: typeof(bool),
                oldType: "bit");

            migrationBuilder.AlterColumn <float>(
                name: "Height",
                table: "Goods",
                nullable: true,
                oldClrType: typeof(float),
                oldType: "real");

            migrationBuilder.AlterColumn <DateTime>(
                name: "RegistrationDate",
                table: "Companies",
                nullable: true,
                oldClrType: typeof(DateTime),
                oldType: "datetime2");

            migrationBuilder.AlterColumn <DateTime>(
                name: "OgrnDate",
                table: "Companies",
                nullable: true,
                oldClrType: typeof(DateTime),
                oldType: "datetime2");

            migrationBuilder.AddUniqueConstraint(
                name: "AK_Passports_Series_Number",
                table: "Passports",
                columns: new[] { "Series", "Number" });
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_ApplicationRoleGroup_Groups_GroupId",
                table: "ApplicationRoleGroup");

            migrationBuilder.DropForeignKey(
                name: "FK_ApplicationRoleGroup_AspNetRoles_RoleId",
                table: "ApplicationRoleGroup");

            migrationBuilder.DropForeignKey(
                name: "FK_ApplicationUserGroup_Groups_GroupId",
                table: "ApplicationUserGroup");

            migrationBuilder.DropForeignKey(
                name: "FK_ApplicationUserGroup_AspNetUsers_UserId1",
                table: "ApplicationUserGroup");

            migrationBuilder.DropPrimaryKey(
                name: "PK_AspNetUserLogins",
                table: "AspNetUserLogins");

            migrationBuilder.DropIndex(
                name: "IX_AspNetUserLogins_UserId",
                table: "AspNetUserLogins");

            migrationBuilder.DropPrimaryKey(
                name: "PK_ApplicationUserGroup",
                table: "ApplicationUserGroup");

            migrationBuilder.DropPrimaryKey(
                name: "PK_ApplicationRoleGroup",
                table: "ApplicationRoleGroup");

            migrationBuilder.DropIndex(
                name: "IX_ApplicationRoleGroup_RoleId",
                table: "ApplicationRoleGroup");

            migrationBuilder.RenameTable(
                name: "ApplicationUserGroup",
                newName: "ApplicationUserGroups");

            migrationBuilder.RenameTable(
                name: "ApplicationRoleGroup",
                newName: "ApplicationRoleGroups");

            migrationBuilder.RenameIndex(
                name: "IX_ApplicationUserGroup_UserId1",
                table: "ApplicationUserGroups",
                newName: "IX_ApplicationUserGroups_UserId1");

            migrationBuilder.RenameIndex(
                name: "IX_ApplicationUserGroup_GroupId",
                table: "ApplicationUserGroups",
                newName: "IX_ApplicationUserGroups_GroupId");

            migrationBuilder.RenameIndex(
                name: "IX_ApplicationRoleGroup_GroupId",
                table: "ApplicationRoleGroups",
                newName: "IX_ApplicationRoleGroups_GroupId");

            migrationBuilder.AlterColumn <string>(
                name: "Name",
                table: "Groups",
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "UserName",
                table: "AspNetUsers",
                maxLength: 256,
                nullable: false,
                oldClrType: typeof(string),
                oldMaxLength: 256,
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "Name",
                table: "AspNetRoles",
                maxLength: 256,
                nullable: false,
                oldClrType: typeof(string),
                oldMaxLength: 256,
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "RoleId",
                table: "ApplicationRoleGroups",
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AddColumn <string>(
                name: "ApplicationUserId",
                table: "ApplicationRoleGroups",
                nullable: true);

            migrationBuilder.AddColumn <string>(
                name: "UserId",
                table: "ApplicationRoleGroups",
                nullable: true);

            migrationBuilder.AddUniqueConstraint(
                name: "AK_AspNetUserLogins_LoginProvider_ProviderKey",
                table: "AspNetUserLogins",
                columns: new[] { "LoginProvider", "ProviderKey" });

            migrationBuilder.AddPrimaryKey(
                name: "PK_AspNetUserLogins",
                table: "AspNetUserLogins",
                columns: new[] { "UserId", "LoginProvider", "ProviderKey" });

            migrationBuilder.AddUniqueConstraint(
                name: "AK_ApplicationUserGroups_UserId",
                table: "ApplicationUserGroups",
                column: "UserId");

            migrationBuilder.AddPrimaryKey(
                name: "PK_ApplicationUserGroups",
                table: "ApplicationUserGroups",
                columns: new[] { "UserId", "GroupId" });

            migrationBuilder.AddUniqueConstraint(
                name: "AK_ApplicationRoleGroups_Id",
                table: "ApplicationRoleGroups",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_ApplicationRoleGroups",
                table: "ApplicationRoleGroups",
                columns: new[] { "RoleId", "GroupId" });

            migrationBuilder.CreateIndex(
                name: "IX_ApplicationRoleGroups_ApplicationUserId",
                table: "ApplicationRoleGroups",
                column: "ApplicationUserId");

            migrationBuilder.AddForeignKey(
                name: "FK_ApplicationRoleGroups_AspNetUsers_ApplicationUserId",
                table: "ApplicationRoleGroups",
                column: "ApplicationUserId",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_ApplicationRoleGroups_Groups_GroupId",
                table: "ApplicationRoleGroups",
                column: "GroupId",
                principalTable: "Groups",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ApplicationRoleGroups_AspNetRoles_RoleId",
                table: "ApplicationRoleGroups",
                column: "RoleId",
                principalTable: "AspNetRoles",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ApplicationUserGroups_Groups_GroupId",
                table: "ApplicationUserGroups",
                column: "GroupId",
                principalTable: "Groups",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_ApplicationUserGroups_AspNetUsers_UserId1",
                table: "ApplicationUserGroups",
                column: "UserId1",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_CourseEnrollment_Metadata_MetaId",
                table: "CourseEnrollment");

            migrationBuilder.DropForeignKey(
                name: "FK_CourseEnrollment_Sections_SectionId",
                table: "CourseEnrollment");

            migrationBuilder.DropForeignKey(
                name: "FK_CourseEnrollment_Students_StudentId",
                table: "CourseEnrollment");

            migrationBuilder.DropPrimaryKey(
                name: "PK_CourseEnrollment",
                table: "CourseEnrollment");

            migrationBuilder.DropIndex(
                name: "IX_CourseEnrollment_StudentId",
                table: "CourseEnrollment");

            migrationBuilder.RenameTable(
                name: "CourseEnrollment",
                newName: "CourseEnrollments");

            migrationBuilder.RenameIndex(
                name: "IX_CourseEnrollment_SectionId",
                table: "CourseEnrollments",
                newName: "IX_CourseEnrollments_SectionId");

            migrationBuilder.RenameIndex(
                name: "IX_CourseEnrollment_MetaId",
                table: "CourseEnrollments",
                newName: "IX_CourseEnrollments_MetaId");

            migrationBuilder.AddPrimaryKey(
                name: "PK_CourseEnrollments",
                table: "CourseEnrollments",
                column: "Id");

            migrationBuilder.AddUniqueConstraint(
                name: "AK_CourseEnrollments_StudentId_SectionId",
                table: "CourseEnrollments",
                columns: new[] { "StudentId", "SectionId" });

            migrationBuilder.AddForeignKey(
                name: "FK_CourseEnrollments_Metadata_MetaId",
                table: "CourseEnrollments",
                column: "MetaId",
                principalTable: "Metadata",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_CourseEnrollments_Sections_SectionId",
                table: "CourseEnrollments",
                column: "SectionId",
                principalTable: "Sections",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_CourseEnrollments_Students_StudentId",
                table: "CourseEnrollments",
                column: "StudentId",
                principalTable: "Students",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Review_Movies_MovieId",
                table: "Review");

            migrationBuilder.DropForeignKey(
                name: "FK_Review_UserDetails_UserDetailId",
                table: "Review");

            migrationBuilder.DropUniqueConstraint(
                name: "AK_Review_MovieId_UserDetailId",
                table: "Review");

            migrationBuilder.DropPrimaryKey(
                name: "PK_Review",
                table: "Review");

            migrationBuilder.RenameTable(
                name: "Review",
                newName: "Reviews");

            migrationBuilder.RenameIndex(
                name: "IX_Review_UserDetailId",
                table: "Reviews",
                newName: "IX_Reviews_UserDetailId");

            migrationBuilder.RenameIndex(
                name: "IX_Review_MovieId",
                table: "Reviews",
                newName: "IX_Reviews_MovieId");

            migrationBuilder.AddUniqueConstraint(
                name: "AK_Reviews_MovieId_UserDetailId",
                table: "Reviews",
                columns: new[] { "MovieId", "UserDetailId" });

            migrationBuilder.AddPrimaryKey(
                name: "PK_Reviews",
                table: "Reviews",
                columns: new[] { "UserDetailId", "MovieId" });

            migrationBuilder.CreateTable(
                name: "Payments",
                columns: table => new
            {
                PaymentId = table.Column <int>(nullable: false)
                            .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                Pay = table.Column <double>(nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_Payments", x => x.PaymentId);
            });

            migrationBuilder.AddForeignKey(
                name: "FK_Reviews_Movies_MovieId",
                table: "Reviews",
                column: "MovieId",
                principalTable: "Movies",
                principalColumn: "MovieId",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_Reviews_UserDetails_UserDetailId",
                table: "Reviews",
                column: "UserDetailId",
                principalTable: "UserDetails",
                principalColumn: "UserDetailID",
                onDelete: ReferentialAction.Cascade);
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Schedules_Employees_EmployeeId",
                table: "Schedules");

            migrationBuilder.DropForeignKey(
                name: "FK_ScheduleBaseSettingses_Schedules_ScheduleId",
                table: "ScheduleBaseSettingses");

            migrationBuilder.DropIndex(
                name: "IX_ScheduleBaseSettingses_ScheduleId",
                table: "ScheduleBaseSettingses");

            migrationBuilder.DropIndex(
                name: "IX_Schedules_EmployeeId",
                table: "Schedules");

            migrationBuilder.DropColumn(
                name: "ScheduleId",
                table: "ScheduleBaseSettingses");

            migrationBuilder.DropColumn(
                name: "EmployeeId",
                table: "Schedules");

            migrationBuilder.AddColumn <int>(
                name: "ScheduleBaseSettingsId",
                table: "Schedules",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn <int>(
                name: "ScheduleId",
                table: "Employees",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn <int>(
                name: "ScheduleId1",
                table: "Employees",
                nullable: true);

            migrationBuilder.AddUniqueConstraint(
                name: "AK_Employees_ScheduleId",
                table: "Employees",
                column: "ScheduleId");

            migrationBuilder.CreateIndex(
                name: "IX_Schedules_ScheduleBaseSettingsId",
                table: "Schedules",
                column: "ScheduleBaseSettingsId");

            migrationBuilder.CreateIndex(
                name: "IX_Employees_ScheduleId1",
                table: "Employees",
                column: "ScheduleId1");

            migrationBuilder.AddForeignKey(
                name: "FK_Employees_Schedules_ScheduleId1",
                table: "Employees",
                column: "ScheduleId1",
                principalTable: "Schedules",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Schedules_ScheduleBaseSettingses_ScheduleBaseSettingsId",
                table: "Schedules",
                column: "ScheduleBaseSettingsId",
                principalTable: "ScheduleBaseSettingses",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_parent_address_student_master",
                table: "parent_address");

            migrationBuilder.DropForeignKey(
                name: "FK_student_documents_student_master",
                table: "student_documents");

            migrationBuilder.DropForeignKey(
                name: "FK_student_comments_student_master",
                table: "student_comments");

            migrationBuilder.DropPrimaryKey(
                name: "PK_student_master",
                table: "student_master");

            migrationBuilder.DropIndex(
                name: "IX_parent_address_tenant_id_school_id_student_id",
                table: "parent_address");

            migrationBuilder.RenameColumn(
                name: "bus_No",
                table: "student_master",
                newName: "bus_no");

            migrationBuilder.AlterColumn <double>(
                name: "credit_hours",
                table: "course",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nchar(5)",
                oldFixedLength: true,
                oldMaxLength: 5,
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "course_category",
                table: "course",
                unicode: false,
                maxLength: 8,
                nullable: true,
                comment: "'Core' or 'Elective'",
                oldClrType: typeof(string),
                oldType: "varchar(100)",
                oldUnicode: false,
                oldMaxLength: 100,
                oldNullable: true);

            migrationBuilder.AddColumn <string>(
                name: "standard",
                table: "course",
                unicode: false,
                maxLength: 50,
                nullable: true,
                comment: "choose between US Common Core library or school specific standards library.");

            migrationBuilder.AddColumn <string>(
                name: "standard_ref_no",
                table: "course",
                unicode: false,
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddUniqueConstraint(
                name: "AK_student_master_tenant_id_school_id_student_guid",
                table: "student_master",
                columns: new[] { "tenant_id", "school_id", "student_guid" });

            migrationBuilder.AddPrimaryKey(
                name: "PK_student_master_1",
                table: "student_master",
                columns: new[] { "tenant_id", "school_id", "student_id" });

            migrationBuilder.CreateTable(
                name: "honor_rolls",
                columns: table => new
            {
                tenant_id         = table.Column <Guid>(nullable: false),
                school_id         = table.Column <int>(nullable: false),
                honor_roll_id     = table.Column <int>(nullable: false),
                marking_period_id = table.Column <int>(nullable: false),
                honor_roll        = table.Column <string>(unicode: false, maxLength: 20, nullable: true),
                breakoff          = table.Column <int>(nullable: true),
                created_by        = table.Column <string>(unicode: false, maxLength: 150, nullable: true),
                created_on        = table.Column <DateTime>(type: "datetime", nullable: true),
                updated_by        = table.Column <string>(unicode: false, maxLength: 150, nullable: true),
                updated_on        = table.Column <DateTime>(type: "datetime", nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_honor_rolls", x => new { x.tenant_id, x.school_id, x.honor_roll_id });
                table.ForeignKey(
                    name: "FK_honor_rolls_honor_rolls",
                    columns: x => new { x.tenant_id, x.school_id, x.marking_period_id },
                    principalTable: "school_years",
                    principalColumns: new[] { "tenant_id", "school_id", "marking_period_id" },
                    onDelete: ReferentialAction.Restrict);
            });

            migrationBuilder.CreateIndex(
                name: "IX_student_master",
                table: "student_master",
                columns: new[] { "tenant_id", "school_id", "student_guid" },
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_student_enrollment_tenant_id_school_id_student_guid",
                table: "student_enrollment",
                columns: new[] { "tenant_id", "school_id", "student_guid" });

            migrationBuilder.CreateIndex(
                name: "IX_honor_rolls_tenant_id_school_id_marking_period_id",
                table: "honor_rolls",
                columns: new[] { "tenant_id", "school_id", "marking_period_id" });

            migrationBuilder.AddForeignKey(
                name: "FK_student_enrollment_student_master",
                table: "student_enrollment",
                columns: new[] { "tenant_id", "school_id", "student_guid" },
                principalTable: "student_master",
                principalColumns: new[] { "tenant_id", "school_id", "student_guid" },
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_student_documents_student_master",
                table: "student_documents",
                columns:  new[] { "tenant_id", "school_id", "student_id" },
                principalTable: "student_master",
                principalColumns: new[] { "tenant_id", "school_id", "student_id" },
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_student_comments_student_master",
                table: "student_comments",
                columns: new[] { "tenant_id", "school_id", "student_id" },
                principalTable: "student_master",
                principalColumns: new[] { "tenant_id", "school_id", "student_id" },
                onDelete: ReferentialAction.Restrict);
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_RoomMessage_RoomUsers_RoomUserId",
                table: "RoomMessage");

            migrationBuilder.DropIndex(
                name: "IX_RoomUsers_RoomId",
                table: "RoomUsers");

            migrationBuilder.DropPrimaryKey(
                name: "PK_RoomMessage",
                table: "RoomMessage");

            migrationBuilder.RenameTable(
                name: "RoomMessage",
                newName: "RoomMessages");

            migrationBuilder.RenameIndex(
                name: "IX_RoomMessage_RoomUserId",
                table: "RoomMessages",
                newName: "IX_RoomMessages_RoomUserId");

            migrationBuilder.AddColumn <int>(
                name: "RoomId",
                table: "RoomMessages",
                type: "INTEGER",
                nullable: true);

            migrationBuilder.AddColumn <DateTime>(
                name: "TimeCreated",
                table: "RoomMessages",
                type: "TEXT",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddUniqueConstraint(
                name: "AK_RoomUsers_RoomId_UserId",
                table: "RoomUsers",
                columns: new[] { "RoomId", "UserId" });

            migrationBuilder.AddPrimaryKey(
                name: "PK_RoomMessages",
                table: "RoomMessages",
                column: "Id");

            migrationBuilder.CreateIndex(
                name: "IX_RoomMessages_RoomId",
                table: "RoomMessages",
                column: "RoomId");

            migrationBuilder.AddForeignKey(
                name: "FK_RoomMessages_Rooms_RoomId",
                table: "RoomMessages",
                column: "RoomId",
                principalTable: "Rooms",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_RoomMessages_RoomUsers_RoomUserId",
                table: "RoomMessages",
                column: "RoomUserId",
                principalTable: "RoomUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
Ejemplo n.º 25
0
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_UserRoles",
                table: "UserRoles");

            migrationBuilder.DropUniqueConstraint(
                name: "AK_UserRoles_UserId_RoleId",
                table: "UserRoles");

            migrationBuilder.DropUniqueConstraint(
                name: "AK_OrganizationItems_OrganizationId_ItemId",
                table: "OrganizationItems");

            migrationBuilder.DropPrimaryKey(
                name: "PK_OrderItems",
                table: "OrderItems");

            migrationBuilder.DropUniqueConstraint(
                name: "AK_OrderItems_OrderId_ItemId",
                table: "OrderItems");

            migrationBuilder.DropPrimaryKey(
                name: "PK_InventoryItems",
                table: "InventoryItems");

            migrationBuilder.DropUniqueConstraint(
                name: "AK_InventoryItems_InventoryId_ItemId",
                table: "InventoryItems");

            migrationBuilder.AlterColumn <int>(
                name: "OrderItemId",
                table: "OrderItems",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "int")
            .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

            migrationBuilder.AlterColumn <int>(
                name: "InventoryItemId",
                table: "InventoryItems",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "int")
            .OldAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

            migrationBuilder.AddUniqueConstraint(
                name: "AK_UserRoles_UserRoleId",
                table: "UserRoles",
                column: "UserRoleId");

            migrationBuilder.AddPrimaryKey(
                name: "PK_UserRoles",
                table: "UserRoles",
                columns: new[] { "UserId", "RoleId" });

            migrationBuilder.AddPrimaryKey(
                name: "PK_OrderItems",
                table: "OrderItems",
                columns: new[] { "OrderId", "ItemId" });

            migrationBuilder.AddPrimaryKey(
                name: "PK_InventoryItems",
                table: "InventoryItems",
                columns: new[] { "InventoryId", "ItemId" });

            migrationBuilder.CreateIndex(
                name: "IX_OrganizationItems_OrganizationId",
                table: "OrganizationItems",
                column: "OrganizationId");
        }
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Reviews_Movies_MovieId",
                table: "Reviews");

            migrationBuilder.DropForeignKey(
                name: "FK_Reviews_UserDetails_UserDetailId",
                table: "Reviews");

            migrationBuilder.DropTable(
                name: "Payments");

            migrationBuilder.DropUniqueConstraint(
                name: "AK_Reviews_MovieId_UserDetailId",
                table: "Reviews");

            migrationBuilder.DropPrimaryKey(
                name: "PK_Reviews",
                table: "Reviews");

            migrationBuilder.RenameTable(
                name: "Reviews",
                newName: "Review");

            migrationBuilder.RenameIndex(
                name: "IX_Reviews_UserDetailId",
                table: "Review",
                newName: "IX_Review_UserDetailId");

            migrationBuilder.RenameIndex(
                name: "IX_Reviews_MovieId",
                table: "Review",
                newName: "IX_Review_MovieId");

            migrationBuilder.AddUniqueConstraint(
                name: "AK_Review_MovieId_UserDetailId",
                table: "Review",
                columns: new[] { "MovieId", "UserDetailId" });

            migrationBuilder.AddPrimaryKey(
                name: "PK_Review",
                table: "Review",
                columns: new[] { "UserDetailId", "MovieId" });

            migrationBuilder.AddForeignKey(
                name: "FK_Review_Movies_MovieId",
                table: "Review",
                column: "MovieId",
                principalTable: "Movies",
                principalColumn: "MovieId",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_Review_UserDetails_UserDetailId",
                table: "Review",
                column: "UserDetailId",
                principalTable: "UserDetails",
                principalColumn: "UserDetailID",
                onDelete: ReferentialAction.Cascade);
        }
Ejemplo n.º 27
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Configuration_User_UserId",
                table: "Configuration");

            migrationBuilder.DropPrimaryKey(
                name: "PK_UserFile",
                table: "UserFile");

            migrationBuilder.DropPrimaryKey(
                name: "PK_Configuration",
                table: "Configuration");

            migrationBuilder.AddColumn <int>(
                name: "UserFileId",
                table: "UserFile",
                nullable: false,
                defaultValue: 0)
            .Annotation("SqlServer:Identity", "1, 1");

            migrationBuilder.AlterColumn <int>(
                name: "UserId",
                table: "Configuration",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "int",
                oldNullable: true);

            migrationBuilder.AddColumn <int>(
                name: "ConfigurationId",
                table: "Configuration",
                nullable: false,
                defaultValue: 0)
            .Annotation("SqlServer:Identity", "1, 1");

            migrationBuilder.AddPrimaryKey(
                name: "PK_UserFile",
                table: "UserFile",
                column: "UserFileId");

            migrationBuilder.AddUniqueConstraint(
                name: "AK_UserFile_UserId_FileName",
                table: "UserFile",
                columns: new[] { "UserId", "FileName" });

            migrationBuilder.AddPrimaryKey(
                name: "PK_Configuration",
                table: "Configuration",
                column: "ConfigurationId");

            migrationBuilder.AddUniqueConstraint(
                name: "AK_Configuration_Group_Name_UserId",
                table: "Configuration",
                columns: new[] { "Group", "Name", "UserId" });

            migrationBuilder.AddForeignKey(
                name: "FK_Configuration_User_UserId",
                table: "Configuration",
                column: "UserId",
                principalTable: "User",
                principalColumn: "UserId",
                onDelete: ReferentialAction.Cascade);
        }
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
                table: "AspNetRoleClaims");

            migrationBuilder.DropForeignKey(
                name: "FK_AspNetUserClaims_AspNetUsers_UserId",
                table: "AspNetUserClaims");

            migrationBuilder.DropForeignKey(
                name: "FK_AspNetUserLogins_AspNetUsers_UserId",
                table: "AspNetUserLogins");

            migrationBuilder.DropForeignKey(
                name: "FK_AspNetUserRoles_AspNetUsers_UserId",
                table: "AspNetUserRoles");

            migrationBuilder.DropForeignKey(
                name: "FK_AspNetUserTokens_AspNetUsers_UserId",
                table: "AspNetUserTokens");

            migrationBuilder.DropPrimaryKey(
                name: "PK_AspNetUsers",
                table: "AspNetUsers");

            migrationBuilder.DropIndex(
                name: "EmailIndex",
                table: "AspNetUsers");

            migrationBuilder.DropIndex(
                name: "UserNameIndex",
                table: "AspNetUsers");

            migrationBuilder.DropPrimaryKey(
                name: "PK_AspNetUserClaims",
                table: "AspNetUserClaims");

            migrationBuilder.DropIndex(
                name: "IX_AspNetUserClaims_UserId",
                table: "AspNetUserClaims");

            migrationBuilder.DropPrimaryKey(
                name: "PK_AspNetRoleClaims",
                table: "AspNetRoleClaims");

            migrationBuilder.DropIndex(
                name: "IX_AspNetRoleClaims_RoleId",
                table: "AspNetRoleClaims");

            migrationBuilder.DropColumn(
                name: "ConcurrencyStamp",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "Email",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "EmailConfirmed",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "LockoutEnabled",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "LockoutEnd",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "NormalizedEmail",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "NormalizedUserName",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "PasswordHash",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "PhoneNumber",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "PhoneNumberConfirmed",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "SecurityStamp",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "TwoFactorEnabled",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "UserName",
                table: "AspNetUsers");

            migrationBuilder.DropColumn(
                name: "Id",
                table: "AspNetUserClaims");

            migrationBuilder.DropColumn(
                name: "ClaimType",
                table: "AspNetUserClaims");

            migrationBuilder.DropColumn(
                name: "ClaimValue",
                table: "AspNetUserClaims");

            migrationBuilder.DropColumn(
                name: "Id",
                table: "AspNetRoleClaims");

            migrationBuilder.DropColumn(
                name: "ClaimType",
                table: "AspNetRoleClaims");

            migrationBuilder.DropColumn(
                name: "ClaimValue",
                table: "AspNetRoleClaims");

            migrationBuilder.RenameTable(
                name: "AspNetUsers",
                newName: "ApplicationUser");

            migrationBuilder.RenameTable(
                name: "AspNetUserClaims",
                newName: "IdentityUserClaim<string>");

            migrationBuilder.RenameTable(
                name: "AspNetRoleClaims",
                newName: "IdentityRoleClaim<string>");

            migrationBuilder.RenameColumn(
                name: "AccessFailedCount",
                table: "ApplicationUser",
                newName: "TempId");

            migrationBuilder.RenameColumn(
                name: "Id",
                table: "ApplicationUser",
                newName: "TempId4");

            migrationBuilder.AddColumn <string>(
                name: "TempId2",
                table: "ApplicationUser",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn <string>(
                name: "TempId3",
                table: "ApplicationUser",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AlterColumn <int>(
                name: "UserId",
                table: "IdentityUserClaim<string>",
                nullable: true,
                oldClrType: typeof(string));

            migrationBuilder.AlterColumn <string>(
                name: "RoleId",
                table: "IdentityRoleClaim<string>",
                nullable: true,
                oldClrType: typeof(string));

            migrationBuilder.AddUniqueConstraint(
                name: "AK_ApplicationUser_TempId",
                table: "ApplicationUser",
                column: "TempId");

            migrationBuilder.AddUniqueConstraint(
                name: "AK_ApplicationUser_TempId2",
                table: "ApplicationUser",
                column: "TempId2");

            migrationBuilder.AddUniqueConstraint(
                name: "AK_ApplicationUser_TempId3",
                table: "ApplicationUser",
                column: "TempId3");

            migrationBuilder.AddUniqueConstraint(
                name: "AK_ApplicationUser_TempId4",
                table: "ApplicationUser",
                column: "TempId4");

            migrationBuilder.AddForeignKey(
                name: "FK_AspNetUserLogins_ApplicationUser_UserId",
                table: "AspNetUserLogins",
                column: "UserId",
                principalTable: "ApplicationUser",
                principalColumn: "TempId2",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_AspNetUserRoles_ApplicationUser_UserId",
                table: "AspNetUserRoles",
                column: "UserId",
                principalTable: "ApplicationUser",
                principalColumn: "TempId3",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_AspNetUserTokens_ApplicationUser_UserId",
                table: "AspNetUserTokens",
                column: "UserId",
                principalTable: "ApplicationUser",
                principalColumn: "TempId4",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_IdentityRoleClaim<string>_AspNetRoles_RoleId",
                table: "IdentityRoleClaim<string>",
                column: "RoleId",
                principalTable: "AspNetRoles",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
                table: "IdentityUserClaim<string>",
                column: "UserId",
                principalTable: "ApplicationUser",
                principalColumn: "TempId",
                onDelete: ReferentialAction.Cascade);
        }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddUniqueConstraint(
                name: "AK_Clube_ClubeId",
                table: "Clube",
                column: "ClubeId");

            migrationBuilder.CreateTable(
                name: "Partida",
                columns: table => new
            {
                Id = table.Column <int>(nullable: false)
                     .Annotation("SqlServer:Identity", "1, 1"),
                PartidaId                    = table.Column <int>(nullable: false),
                Rodada                       = table.Column <int>(nullable: false),
                ClubeCasaId                  = table.Column <int>(nullable: false),
                ClubeCasaPosicao             = table.Column <int>(nullable: false),
                ClubeVisitanteId             = table.Column <int>(nullable: false),
                AproveitamentoClubeMandante  = table.Column <string>(maxLength: 16, nullable: true),
                AproveitamentoClubeVisitante = table.Column <string>(maxLength: 16, nullable: true),
                ClubeVisitantePosicao        = table.Column <int>(nullable: false),
                DataPartida                  = table.Column <DateTime>(nullable: false),
                LocalPartida                 = table.Column <string>(maxLength: 64, nullable: true),
                PartidaValida                = table.Column <bool>(nullable: false),
                PlacarOficialMandante        = table.Column <int>(nullable: false),
                PlacarOficialVisitante       = table.Column <int>(nullable: false),
                UrlConfronto                 = table.Column <string>(maxLength: 256, nullable: true),
                UrlTransmissao               = table.Column <string>(maxLength: 256, nullable: true),
                DataModificacao              = table.Column <DateTime>(nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_Partida", x => x.Id);
                table.ForeignKey(
                    name: "FK_Partida_Clube_ClubeCasaId",
                    column: x => x.ClubeCasaId,
                    principalTable: "Clube",
                    principalColumn: "ClubeId",
                    onDelete: ReferentialAction.Cascade);
                table.ForeignKey(
                    name: "FK_Partida_Clube_ClubeVisitanteId",
                    column: x => x.ClubeVisitanteId,
                    principalTable: "Clube",
                    principalColumn: "ClubeId");
            });

            migrationBuilder.CreateTable(
                name: "Transmissao",
                columns: table => new
            {
                TransmissaoId = table.Column <int>(nullable: false)
                                .Annotation("SqlServer:Identity", "1, 1"),
                PartidaId       = table.Column <int>(nullable: false),
                Label           = table.Column <string>(maxLength: 128, nullable: true),
                Url             = table.Column <string>(maxLength: 256, nullable: true),
                DataModificacao = table.Column <DateTime>(nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_Transmissao", x => x.TransmissaoId);
                table.ForeignKey(
                    name: "FK_Transmissao_Partida_PartidaId",
                    column: x => x.PartidaId,
                    principalTable: "Partida",
                    principalColumn: "Id",
                    onDelete: ReferentialAction.Cascade);
            });

            migrationBuilder.CreateIndex(
                name: "IX_Status_StatusId",
                table: "Status",
                column: "StatusId",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Esquema_EsquemaId",
                table: "Esquema",
                column: "EsquemaId",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Partida_ClubeCasaId",
                table: "Partida",
                column: "ClubeCasaId");

            migrationBuilder.CreateIndex(
                name: "IX_Partida_ClubeVisitanteId",
                table: "Partida",
                column: "ClubeVisitanteId");

            migrationBuilder.CreateIndex(
                name: "IX_Partida_PartidaId",
                table: "Partida",
                column: "PartidaId",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Transmissao_PartidaId",
                table: "Transmissao",
                column: "PartidaId",
                unique: true);
        }
Ejemplo n.º 30
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_AspNetUserClaims_AspNetUsers_UserId",
                table: "AspNetUserClaims");

            migrationBuilder.DropForeignKey(
                name: "FK_AspNetUserLogins_AspNetUsers_UserId",
                table: "AspNetUserLogins");

            migrationBuilder.DropForeignKey(
                name: "FK_AspNetUserRoles_AspNetUsers_UserId",
                table: "AspNetUserRoles");

            migrationBuilder.DropPrimaryKey(
                name: "PK_AspNetUsers",
                table: "AspNetUsers");

            migrationBuilder.DropIndex(
                name: "UserNameIndex",
                table: "AspNetUsers");

            migrationBuilder.DropIndex(
                name: "IX_AspNetUserRoles_UserId",
                table: "AspNetUserRoles");

            migrationBuilder.DropIndex(
                name: "RoleNameIndex",
                table: "AspNetRoles");

            migrationBuilder.RenameColumn(
                name: "Id",
                table: "AspNetUsers",
                newName: "ID");

            migrationBuilder.AlterColumn <int>(
                name: "ID",
                table: "AspNetUsers",
                nullable: false,
                oldClrType: typeof(string));

            migrationBuilder.AddColumn <string>(
                name: "Id",
                table: "AspNetUsers",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn <string>(
                name: "BirthDate",
                table: "AspNetUsers",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn <string>(
                name: "Company",
                table: "AspNetUsers",
                nullable: true);

            migrationBuilder.AddColumn <string>(
                name: "FirstName",
                table: "AspNetUsers",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn <string>(
                name: "LastName",
                table: "AspNetUsers",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn <string>(
                name: "Position",
                table: "AspNetUsers",
                nullable: true);

            migrationBuilder.AddUniqueConstraint(
                name: "AK_AspNetUsers_ID",
                table: "AspNetUsers",
                column: "ID");

            migrationBuilder.AddPrimaryKey(
                name: "PK_AspNetUsers",
                table: "AspNetUsers",
                column: "Id");

            migrationBuilder.CreateTable(
                name: "Dealership",
                columns: table => new
            {
                ID = table.Column <int>(nullable: false)
                     .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                Email       = table.Column <string>(nullable: false),
                Name        = table.Column <string>(nullable: false),
                PhoneNumber = table.Column <string>(nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_Dealership", x => x.ID);
            });

            migrationBuilder.CreateIndex(
                name: "UserNameIndex",
                table: "AspNetUsers",
                column: "NormalizedUserName",
                unique: true,
                filter: "[NormalizedUserName] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "RoleNameIndex",
                table: "AspNetRoles",
                column: "NormalizedName",
                unique: true,
                filter: "[NormalizedName] IS NOT NULL");

            migrationBuilder.AddForeignKey(
                name: "FK_AspNetUserClaims_AspNetUsers_UserId",
                table: "AspNetUserClaims",
                column: "UserId",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_AspNetUserLogins_AspNetUsers_UserId",
                table: "AspNetUserLogins",
                column: "UserId",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_AspNetUserRoles_AspNetUsers_UserId",
                table: "AspNetUserRoles",
                column: "UserId",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_AspNetUserTokens_AspNetUsers_UserId",
                table: "AspNetUserTokens",
                column: "UserId",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
Ejemplo n.º 31
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_Ratings_PostId",
                table: "Ratings");

            migrationBuilder.AlterColumn <DateTime>(
                name: "UpdatedOn",
                table: "UserProfiles",
                type: "datetime2",
                nullable: false,
                defaultValueSql: "CURRENT_TIMESTAMP",
                oldClrType: typeof(DateTime),
                oldType: "datetime2");

            migrationBuilder.AlterColumn <string>(
                name: "Id",
                table: "UserProfiles",
                type: "nvarchar(450)",
                nullable: false,
                defaultValue: "",
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn <DateTime>(
                name: "CreatedOn",
                table: "UserProfiles",
                type: "datetime2",
                nullable: false,
                defaultValueSql: "CURRENT_TIMESTAMP",
                oldClrType: typeof(DateTime),
                oldType: "datetime2");

            migrationBuilder.AlterColumn <string>(
                name: "UserId",
                table: "Ratings",
                type: "nvarchar(450)",
                nullable: false,
                defaultValue: "",
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "AuthorId",
                table: "Posts",
                type: "nvarchar(450)",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "AuthorId",
                table: "Comments",
                type: "nvarchar(450)",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AlterColumn <string>(
                name: "UserId",
                table: "AuthorVerifications",
                type: "nvarchar(450)",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)",
                oldNullable: true);

            migrationBuilder.AddColumn <string>(
                name: "Discriminator",
                table: "AspNetUsers",
                type: "nvarchar(max)",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddPrimaryKey(
                name: "PK_UserProfiles",
                table: "UserProfiles",
                column: "Id");

            migrationBuilder.AddUniqueConstraint(
                name: "AK_Ratings_PostId_UserId",
                table: "Ratings",
                columns: new[] { "PostId", "UserId" });

            migrationBuilder.CreateIndex(
                name: "IX_Ratings_UserId",
                table: "Ratings",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_Posts_AuthorId",
                table: "Posts",
                column: "AuthorId");

            migrationBuilder.CreateIndex(
                name: "IX_Comments_AuthorId",
                table: "Comments",
                column: "AuthorId");

            migrationBuilder.CreateIndex(
                name: "IX_AuthorVerifications_UserId",
                table: "AuthorVerifications",
                column: "UserId");

            migrationBuilder.AddForeignKey(
                name: "FK_AuthorVerifications_AspNetUsers_UserId",
                table: "AuthorVerifications",
                column: "UserId",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_Comments_AspNetUsers_AuthorId",
                table: "Comments",
                column: "AuthorId",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.SetNull);

            migrationBuilder.AddForeignKey(
                name: "FK_Posts_AspNetUsers_AuthorId",
                table: "Posts",
                column: "AuthorId",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.SetNull);

            migrationBuilder.AddForeignKey(
                name: "FK_Ratings_AspNetUsers_UserId",
                table: "Ratings",
                column: "UserId",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_UserProfiles_AspNetUsers_Id",
                table: "UserProfiles",
                column: "Id",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
Ejemplo n.º 32
0
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "UserUseCase");

            migrationBuilder.DeleteData(
                table: "UseCases",
                keyColumn: "Id",
                keyValue: 29);

            migrationBuilder.DeleteData(
                table: "UseCases",
                keyColumn: "Id",
                keyValue: 30);

            migrationBuilder.AddUniqueConstraint(
                name: "AK_Users_Username",
                table: "Users",
                column: "Username");

            migrationBuilder.UpdateData(
                table: "Roles",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2020, 6, 30, 19, 41, 41, 666, DateTimeKind.Utc).AddTicks(1315));

            migrationBuilder.UpdateData(
                table: "Roles",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2020, 6, 30, 19, 41, 41, 666, DateTimeKind.Utc).AddTicks(2874));

            migrationBuilder.UpdateData(
                table: "Roles",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2020, 6, 30, 19, 41, 41, 666, DateTimeKind.Utc).AddTicks(2901));

            migrationBuilder.UpdateData(
                table: "Users",
                keyColumn: "Id",
                keyValue: 1,
                columns: new[] { "CreatedAt", "IsActive" },
                values: new object[] { new DateTime(2020, 6, 30, 19, 41, 41, 666, DateTimeKind.Utc).AddTicks(5865), true });

            migrationBuilder.UpdateData(
                table: "Users",
                keyColumn: "Id",
                keyValue: 2,
                columns: new[] { "CreatedAt", "IsActive" },
                values: new object[] { new DateTime(2020, 6, 30, 19, 41, 41, 666, DateTimeKind.Utc).AddTicks(9975), true });

            migrationBuilder.UpdateData(
                table: "Users",
                keyColumn: "Id",
                keyValue: 3,
                columns: new[] { "CreatedAt", "IsActive" },
                values: new object[] { new DateTime(2020, 6, 30, 19, 41, 41, 667, DateTimeKind.Utc).AddTicks(47), true });
        }
Ejemplo n.º 33
0
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_CRM_CustomerFile",
                table: "CRM_CustomerFile");

            migrationBuilder.DropPrimaryKey(
                name: "PK_CRM_CustomerContact",
                table: "CRM_CustomerContact");

            migrationBuilder.DropPrimaryKey(
                name: "PK_CRM_CustomerBrand",
                table: "CRM_CustomerBrand");

            migrationBuilder.DropPrimaryKey(
                name: "PK_CRM_Customer",
                table: "CRM_Customer");

            migrationBuilder.DropPrimaryKey(
                name: "PK_CRM_Brand",
                table: "CRM_Brand");

            migrationBuilder.AddColumn <string>(
                name: "CountryCode",
                table: "CRM_CustomerFile",
                maxLength: 20,
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn <string>(
                name: "CountryCode",
                table: "CRM_CustomerContact",
                maxLength: 20,
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn <string>(
                name: "CountryCode",
                table: "CRM_CustomerBrand",
                maxLength: 20,
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn <string>(
                name: "CountryCode",
                table: "CRM_Customer",
                maxLength: 20,
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn <string>(
                name: "CountryCode",
                table: "CRM_Brand",
                maxLength: 20,
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddUniqueConstraint(
                name: "AK_CRM_CustomerFile_CountryCode_CustomerBrandId",
                table: "CRM_CustomerFile",
                columns: new[] { "CountryCode", "CustomerBrandId" });

            migrationBuilder.AddPrimaryKey(
                name: "PK_CRM_CustomerFile",
                table: "CRM_CustomerFile",
                columns: new[] { "CustomerBrandId", "CountryCode" });

            migrationBuilder.AddUniqueConstraint(
                name: "AK_CRM_CustomerContact_CountryCode_CustomerContactId",
                table: "CRM_CustomerContact",
                columns: new[] { "CountryCode", "CustomerContactId" });

            migrationBuilder.AddPrimaryKey(
                name: "PK_CRM_CustomerContact",
                table: "CRM_CustomerContact",
                columns: new[] { "CustomerContactId", "CountryCode" });

            migrationBuilder.AddUniqueConstraint(
                name: "AK_CRM_CustomerBrand_CountryCode_CustomerBrandId",
                table: "CRM_CustomerBrand",
                columns: new[] { "CountryCode", "CustomerBrandId" });

            migrationBuilder.AddPrimaryKey(
                name: "PK_CRM_CustomerBrand",
                table: "CRM_CustomerBrand",
                columns: new[] { "CustomerBrandId", "CountryCode" });

            migrationBuilder.AddUniqueConstraint(
                name: "AK_CRM_Customer_CountryCode_CustomerId",
                table: "CRM_Customer",
                columns: new[] { "CountryCode", "CustomerId" });

            migrationBuilder.AddPrimaryKey(
                name: "PK_CRM_Customer",
                table: "CRM_Customer",
                columns: new[] { "CustomerId", "CountryCode" });

            migrationBuilder.AddUniqueConstraint(
                name: "AK_CRM_Brand_CountryCode_BrandId",
                table: "CRM_Brand",
                columns: new[] { "CountryCode", "BrandId" });

            migrationBuilder.AddPrimaryKey(
                name: "PK_CRM_Brand",
                table: "CRM_Brand",
                columns: new[] { "BrandId", "CountryCode" });
        }
 protected override void Down(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_Gebruiker_UserId", table: "AspNetUserClaims");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_Gebruiker_UserId", table: "AspNetUserLogins");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
     migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_Gebruiker_UserId", table: "AspNetUserRoles");
     migrationBuilder.DropForeignKey(name: "FK_BestellingMateriaalItem_Bestelling_BestellingId", table: "BestellingMateriaalItem");
     migrationBuilder.DropForeignKey(name: "FK_BestellingMateriaalItem_MateriaalItem_MateriaalItemId", table: "BestellingMateriaalItem");
     migrationBuilder.DropForeignKey(name: "FK_MateriaalDoelgroep_Doelgroep_DoelgroepId", table: "MateriaalDoelgroep");
     migrationBuilder.DropForeignKey(name: "FK_MateriaalDoelgroep_Materiaal_MateriaalId", table: "MateriaalDoelgroep");
     migrationBuilder.DropForeignKey(name: "FK_MateriaalItem_Materiaal_MateriaalId", table: "MateriaalItem");
     migrationBuilder.DropForeignKey(name: "FK_MateriaalLeergebied_Leergebied_LeergebiedId", table: "MateriaalLeergebied");
     migrationBuilder.DropForeignKey(name: "FK_MateriaalLeergebied_Materiaal_MateriaalId", table: "MateriaalLeergebied");
     migrationBuilder.DropForeignKey(name: "FK_MateriaalVerlanglijst_Materiaal_MateriaalId", table: "MateriaalVerlanglijst");
     migrationBuilder.DropForeignKey(name: "FK_MateriaalVerlanglijst_Verlanglijst_VerlanglijstId", table: "MateriaalVerlanglijst");
     migrationBuilder.DropForeignKey(name: "FK_Uitleeninformatie_MateriaalItem_MateriaalItemId", table: "Uitleeninformatie");
     migrationBuilder.DropForeignKey(name: "FK_Verlanglijst_Gebruiker_GebruikerId1", table: "Verlanglijst");
     migrationBuilder.DropColumn(name: "GebruikerId", table: "Verlanglijst");
     migrationBuilder.DropColumn(name: "GebruikerId1", table: "Verlanglijst");
     migrationBuilder.AddColumn<int>(
         name: "GebruikerForeignKey",
         table: "Verlanglijst",
         nullable: false,
         defaultValue: 0);
     migrationBuilder.AddColumn<int>(
         name: "GebruikerForeignKey",
         table: "AspNetUsers",
         nullable: false,
         defaultValue: 0);
     migrationBuilder.AddUniqueConstraint(
         name: "AK_Gebruiker_GebruikerForeignKey",
         table: "AspNetUsers",
         column: "GebruikerForeignKey");
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
         table: "AspNetRoleClaims",
         column: "RoleId",
         principalTable: "AspNetRoles",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserClaim<string>_Gebruiker_UserId",
         table: "AspNetUserClaims",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserLogin<string>_Gebruiker_UserId",
         table: "AspNetUserLogins",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
         table: "AspNetUserRoles",
         column: "RoleId",
         principalTable: "AspNetRoles",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_IdentityUserRole<string>_Gebruiker_UserId",
         table: "AspNetUserRoles",
         column: "UserId",
         principalTable: "AspNetUsers",
         principalColumn: "Id",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_BestellingMateriaalItem_Bestelling_BestellingId",
         table: "BestellingMateriaalItem",
         column: "BestellingId",
         principalTable: "Bestelling",
         principalColumn: "BestellingId",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_BestellingMateriaalItem_MateriaalItem_MateriaalItemId",
         table: "BestellingMateriaalItem",
         column: "MateriaalItemId",
         principalTable: "MateriaalItem",
         principalColumn: "MateriaalItemId",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_MateriaalDoelgroep_Doelgroep_DoelgroepId",
         table: "MateriaalDoelgroep",
         column: "DoelgroepId",
         principalTable: "Doelgroep",
         principalColumn: "DoelgroepId",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_MateriaalDoelgroep_Materiaal_MateriaalId",
         table: "MateriaalDoelgroep",
         column: "MateriaalId",
         principalTable: "Materiaal",
         principalColumn: "MateriaalId",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_MateriaalItem_Materiaal_MateriaalId",
         table: "MateriaalItem",
         column: "MateriaalId",
         principalTable: "Materiaal",
         principalColumn: "MateriaalId",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_MateriaalLeergebied_Leergebied_LeergebiedId",
         table: "MateriaalLeergebied",
         column: "LeergebiedId",
         principalTable: "Leergebied",
         principalColumn: "LeergebiedId",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_MateriaalLeergebied_Materiaal_MateriaalId",
         table: "MateriaalLeergebied",
         column: "MateriaalId",
         principalTable: "Materiaal",
         principalColumn: "MateriaalId",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_MateriaalVerlanglijst_Materiaal_MateriaalId",
         table: "MateriaalVerlanglijst",
         column: "MateriaalId",
         principalTable: "Materiaal",
         principalColumn: "MateriaalId",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_MateriaalVerlanglijst_Verlanglijst_VerlanglijstId",
         table: "MateriaalVerlanglijst",
         column: "VerlanglijstId",
         principalTable: "Verlanglijst",
         principalColumn: "VerlanglijstId",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_Uitleeninformatie_MateriaalItem_MateriaalItemId",
         table: "Uitleeninformatie",
         column: "MateriaalItemId",
         principalTable: "MateriaalItem",
         principalColumn: "MateriaalItemId",
         onDelete: ReferentialAction.Restrict);
     migrationBuilder.AddForeignKey(
         name: "FK_Verlanglijst_Gebruiker_GebruikerForeignKey",
         table: "Verlanglijst",
         column: "GebruikerForeignKey",
         principalTable: "AspNetUsers",
         principalColumn: "GebruikerForeignKey",
         onDelete: ReferentialAction.Restrict);
 }
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddUniqueConstraint(
                name: "AK_Game_GameName",
                table: "Game",
                column: "GameName");

            migrationBuilder.AddUniqueConstraint(
                name: "AK_Client_Email",
                table: "Client",
                column: "Email");

            migrationBuilder.AddUniqueConstraint(
                name: "AK_Client_UserName",
                table: "Client",
                column: "UserName");

            migrationBuilder.CreateTable(
                name: "OverviewType",
                columns: table => new
            {
                TypeID = table.Column <Guid>(nullable: false)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_OverviewType", x => x.TypeID);
            });

            migrationBuilder.CreateTable(
                name: "Overview",
                columns: table => new
            {
                OverviewID         = table.Column <Guid>(nullable: false),
                GameID             = table.Column <Guid>(nullable: false),
                TypeID             = table.Column <Guid>(nullable: false),
                OverviewTypeTypeID = table.Column <Guid>(nullable: true)
            },
                constraints: table =>
            {
                table.PrimaryKey("PK_Overview", x => x.OverviewID);
                table.ForeignKey(
                    name: "FK_Overview_Game_GameID",
                    column: x => x.GameID,
                    principalTable: "Game",
                    principalColumn: "GameID",
                    onDelete: ReferentialAction.Cascade);
                table.ForeignKey(
                    name: "FK_Overview_OverviewType_OverviewTypeTypeID",
                    column: x => x.OverviewTypeTypeID,
                    principalTable: "OverviewType",
                    principalColumn: "TypeID",
                    onDelete: ReferentialAction.Restrict);
            });

            migrationBuilder.CreateIndex(
                name: "IX_Overview_GameID",
                table: "Overview",
                column: "GameID");

            migrationBuilder.CreateIndex(
                name: "IX_Overview_OverviewTypeTypeID",
                table: "Overview",
                column: "OverviewTypeTypeID");
        }