CodeLiturgy.Dashboard/CodeLiturgy.Views/Migrations/20221126001445_Init.cs

520 lines
18 KiB
C#
Raw Normal View History

2022-11-30 18:52:55 +03:00
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CodeLiturgy.Views.Migrations
{
public partial class Init : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_AspNetRoleClaims_AspNetRoles_ApplicationRoleId",
table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(
name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(
name: "FK_AspNetUserClaims_AspNetUsers_ApplicationUserId",
table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(
name: "FK_AspNetUserClaims_AspNetUsers_UserId",
table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(
name: "FK_AspNetUserLogins_AspNetUsers_UserId",
table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(
name: "FK_AspNetUserRoles_AspNetRoles_ApplicationRoleId",
table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(
name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(
name: "FK_AspNetUserRoles_AspNetUsers_UserId",
table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(
name: "FK_AspNetUserRoles_AspNetUsers_UserId1",
table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(
name: "FK_AspNetUserTokens_AspNetUsers_UserId",
table: "AspNetUserTokens");
migrationBuilder.DropForeignKey(
name: "FK_Site_site_env_EnvironmentId",
table: "Site");
migrationBuilder.DropForeignKey(
name: "FK_site_env_AspNetUsers_UserId",
table: "site_env");
migrationBuilder.DropPrimaryKey(
name: "PK_site_env",
table: "site_env");
migrationBuilder.DropPrimaryKey(
name: "PK_AspNetUsers",
table: "AspNetUsers");
migrationBuilder.DropPrimaryKey(
name: "PK_AspNetUserRoles",
table: "AspNetUserRoles");
migrationBuilder.DropIndex(
name: "IX_AspNetUserRoles_UserId1",
table: "AspNetUserRoles");
migrationBuilder.DropPrimaryKey(
name: "PK_AspNetRoles",
table: "AspNetRoles");
migrationBuilder.DropPrimaryKey(
name: "PK_AspNetRoleClaims",
table: "AspNetRoleClaims");
migrationBuilder.DropColumn(
name: "UserId1",
table: "AspNetUserRoles");
migrationBuilder.RenameTable(
name: "site_env",
newName: "SiteEnvironment");
migrationBuilder.RenameTable(
name: "AspNetUsers",
newName: "ApplicationUser");
migrationBuilder.RenameTable(
name: "AspNetUserRoles",
newName: "UserRole");
migrationBuilder.RenameTable(
name: "AspNetRoles",
newName: "Roles");
migrationBuilder.RenameTable(
name: "AspNetRoleClaims",
newName: "RoleClaims");
migrationBuilder.RenameColumn(
name: "EnvironmentType",
table: "Site",
newName: "SiteType");
migrationBuilder.RenameIndex(
name: "IX_site_env_UserId",
table: "SiteEnvironment",
newName: "IX_SiteEnvironment_UserId");
migrationBuilder.RenameIndex(
name: "IX_AspNetUserRoles_RoleId",
table: "UserRole",
newName: "IX_UserRole_RoleId");
migrationBuilder.RenameIndex(
name: "IX_AspNetUserRoles_ApplicationRoleId",
table: "UserRole",
newName: "IX_UserRole_ApplicationRoleId");
migrationBuilder.RenameIndex(
name: "IX_AspNetRoleClaims_RoleId",
table: "RoleClaims",
newName: "IX_RoleClaims_RoleId");
migrationBuilder.RenameIndex(
name: "IX_AspNetRoleClaims_ApplicationRoleId",
table: "RoleClaims",
newName: "IX_RoleClaims_ApplicationRoleId");
migrationBuilder.AddColumn<string>(
name: "UserId",
table: "Site",
type: "text",
nullable: true);
migrationBuilder.AddPrimaryKey(
name: "PK_SiteEnvironment",
table: "SiteEnvironment",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_ApplicationUser",
table: "ApplicationUser",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_UserRole",
table: "UserRole",
columns: new[] { "UserId", "RoleId" });
migrationBuilder.AddPrimaryKey(
name: "PK_Roles",
table: "Roles",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_RoleClaims",
table: "RoleClaims",
column: "Id");
migrationBuilder.CreateIndex(
name: "IX_Site_UserId",
table: "Site",
column: "UserId");
migrationBuilder.AddForeignKey(
name: "FK_AspNetUserClaims_ApplicationUser_ApplicationUserId",
table: "AspNetUserClaims",
column: "ApplicationUserId",
principalTable: "ApplicationUser",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_AspNetUserClaims_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "ApplicationUser",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AspNetUserLogins_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "ApplicationUser",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AspNetUserTokens_ApplicationUser_UserId",
table: "AspNetUserTokens",
column: "UserId",
principalTable: "ApplicationUser",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RoleClaims_Roles_ApplicationRoleId",
table: "RoleClaims",
column: "ApplicationRoleId",
principalTable: "Roles",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_RoleClaims_Roles_RoleId",
table: "RoleClaims",
column: "RoleId",
principalTable: "Roles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Site_ApplicationUser_UserId",
table: "Site",
column: "UserId",
principalTable: "ApplicationUser",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Site_SiteEnvironment_EnvironmentId",
table: "Site",
column: "EnvironmentId",
principalTable: "SiteEnvironment",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_SiteEnvironment_ApplicationUser_UserId",
table: "SiteEnvironment",
column: "UserId",
principalTable: "ApplicationUser",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_UserRole_ApplicationUser_UserId",
table: "UserRole",
column: "UserId",
principalTable: "ApplicationUser",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_UserRole_Roles_ApplicationRoleId",
table: "UserRole",
column: "ApplicationRoleId",
principalTable: "Roles",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_UserRole_Roles_RoleId",
table: "UserRole",
column: "RoleId",
principalTable: "Roles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_AspNetUserClaims_ApplicationUser_ApplicationUserId",
table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(
name: "FK_AspNetUserClaims_ApplicationUser_UserId",
table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(
name: "FK_AspNetUserLogins_ApplicationUser_UserId",
table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(
name: "FK_AspNetUserTokens_ApplicationUser_UserId",
table: "AspNetUserTokens");
migrationBuilder.DropForeignKey(
name: "FK_RoleClaims_Roles_ApplicationRoleId",
table: "RoleClaims");
migrationBuilder.DropForeignKey(
name: "FK_RoleClaims_Roles_RoleId",
table: "RoleClaims");
migrationBuilder.DropForeignKey(
name: "FK_Site_ApplicationUser_UserId",
table: "Site");
migrationBuilder.DropForeignKey(
name: "FK_Site_SiteEnvironment_EnvironmentId",
table: "Site");
migrationBuilder.DropForeignKey(
name: "FK_SiteEnvironment_ApplicationUser_UserId",
table: "SiteEnvironment");
migrationBuilder.DropForeignKey(
name: "FK_UserRole_ApplicationUser_UserId",
table: "UserRole");
migrationBuilder.DropForeignKey(
name: "FK_UserRole_Roles_ApplicationRoleId",
table: "UserRole");
migrationBuilder.DropForeignKey(
name: "FK_UserRole_Roles_RoleId",
table: "UserRole");
migrationBuilder.DropIndex(
name: "IX_Site_UserId",
table: "Site");
migrationBuilder.DropPrimaryKey(
name: "PK_UserRole",
table: "UserRole");
migrationBuilder.DropPrimaryKey(
name: "PK_SiteEnvironment",
table: "SiteEnvironment");
migrationBuilder.DropPrimaryKey(
name: "PK_Roles",
table: "Roles");
migrationBuilder.DropPrimaryKey(
name: "PK_RoleClaims",
table: "RoleClaims");
migrationBuilder.DropPrimaryKey(
name: "PK_ApplicationUser",
table: "ApplicationUser");
migrationBuilder.DropColumn(
name: "UserId",
table: "Site");
migrationBuilder.RenameTable(
name: "UserRole",
newName: "AspNetUserRoles");
migrationBuilder.RenameTable(
name: "SiteEnvironment",
newName: "site_env");
migrationBuilder.RenameTable(
name: "Roles",
newName: "AspNetRoles");
migrationBuilder.RenameTable(
name: "RoleClaims",
newName: "AspNetRoleClaims");
migrationBuilder.RenameTable(
name: "ApplicationUser",
newName: "AspNetUsers");
migrationBuilder.RenameColumn(
name: "SiteType",
table: "Site",
newName: "EnvironmentType");
migrationBuilder.RenameIndex(
name: "IX_UserRole_RoleId",
table: "AspNetUserRoles",
newName: "IX_AspNetUserRoles_RoleId");
migrationBuilder.RenameIndex(
name: "IX_UserRole_ApplicationRoleId",
table: "AspNetUserRoles",
newName: "IX_AspNetUserRoles_ApplicationRoleId");
migrationBuilder.RenameIndex(
name: "IX_SiteEnvironment_UserId",
table: "site_env",
newName: "IX_site_env_UserId");
migrationBuilder.RenameIndex(
name: "IX_RoleClaims_RoleId",
table: "AspNetRoleClaims",
newName: "IX_AspNetRoleClaims_RoleId");
migrationBuilder.RenameIndex(
name: "IX_RoleClaims_ApplicationRoleId",
table: "AspNetRoleClaims",
newName: "IX_AspNetRoleClaims_ApplicationRoleId");
migrationBuilder.AddColumn<string>(
name: "UserId1",
table: "AspNetUserRoles",
type: "text",
nullable: true);
migrationBuilder.AddPrimaryKey(
name: "PK_AspNetUserRoles",
table: "AspNetUserRoles",
columns: new[] { "UserId", "RoleId" });
migrationBuilder.AddPrimaryKey(
name: "PK_site_env",
table: "site_env",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_AspNetRoles",
table: "AspNetRoles",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_AspNetRoleClaims",
table: "AspNetRoleClaims",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_AspNetUsers",
table: "AspNetUsers",
column: "Id");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserRoles_UserId1",
table: "AspNetUserRoles",
column: "UserId1");
migrationBuilder.AddForeignKey(
name: "FK_AspNetRoleClaims_AspNetRoles_ApplicationRoleId",
table: "AspNetRoleClaims",
column: "ApplicationRoleId",
principalTable: "AspNetRoles",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AspNetUserClaims_AspNetUsers_ApplicationUserId",
table: "AspNetUserClaims",
column: "ApplicationUserId",
principalTable: "AspNetUsers",
principalColumn: "Id");
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_AspNetRoles_ApplicationRoleId",
table: "AspNetUserRoles",
column: "ApplicationRoleId",
principalTable: "AspNetRoles",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
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_AspNetUserRoles_AspNetUsers_UserId1",
table: "AspNetUserRoles",
column: "UserId1",
principalTable: "AspNetUsers",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_AspNetUserTokens_AspNetUsers_UserId",
table: "AspNetUserTokens",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Site_site_env_EnvironmentId",
table: "Site",
column: "EnvironmentId",
principalTable: "site_env",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_site_env_AspNetUsers_UserId",
table: "site_env",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id");
}
}
}