LANCommander/LANCommander.Server.Data.SQLite/Migrations/20241016042616_UseCustomIdentityModels.cs

324 lines
10 KiB
C#
Raw Permalink Normal View History

2024-10-15 23:48:16 -05:00
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LANCommander.Migrations
{
/// <inheritdoc />
public partial class UseCustomIdentityModels : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_UserCustomField_Users_CreatedById",
table: "UserCustomField");
migrationBuilder.DropForeignKey(
name: "FK_UserCustomField_Users_UpdatedById",
table: "UserCustomField");
migrationBuilder.DropColumn(
name: "Discriminator",
table: "Users");
migrationBuilder.DropColumn(
name: "Discriminator",
table: "Roles");
migrationBuilder.AlterColumn<DateTime>(
name: "RefreshTokenExpiration",
table: "Users",
type: "TEXT",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
oldClrType: typeof(DateTime),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AlterColumn<bool>(
name: "Approved",
table: "Users",
type: "INTEGER",
nullable: false,
defaultValue: false,
oldClrType: typeof(bool),
oldType: "INTEGER",
oldNullable: true);
migrationBuilder.AddColumn<Guid>(
name: "CreatedById",
table: "Users",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "CreatedOn",
table: "Users",
type: "TEXT",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<Guid>(
name: "UpdatedById",
table: "Users",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "UpdatedOn",
table: "Users",
type: "TEXT",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<Guid>(
name: "CreatedById",
table: "Roles",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "CreatedOn",
table: "Roles",
type: "TEXT",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<Guid>(
name: "UpdatedById",
table: "Roles",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "UpdatedOn",
table: "Roles",
type: "TEXT",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<Guid>(
name: "UserId",
table: "Roles",
type: "TEXT",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Users_CreatedById",
table: "Users",
column: "CreatedById");
migrationBuilder.CreateIndex(
name: "IX_Users_UpdatedById",
table: "Users",
column: "UpdatedById");
migrationBuilder.CreateIndex(
name: "IX_Roles_CreatedById",
table: "Roles",
column: "CreatedById");
migrationBuilder.CreateIndex(
name: "IX_Roles_UpdatedById",
table: "Roles",
column: "UpdatedById");
migrationBuilder.CreateIndex(
name: "IX_Roles_UserId",
table: "Roles",
column: "UserId");
migrationBuilder.AddForeignKey(
name: "FK_Roles_Users_CreatedById",
table: "Roles",
column: "CreatedById",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Roles_Users_UpdatedById",
table: "Roles",
column: "UpdatedById",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Roles_Users_UserId",
table: "Roles",
column: "UserId",
principalTable: "Users",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_UserCustomField_Users_CreatedById",
table: "UserCustomField",
column: "CreatedById",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_UserCustomField_Users_UpdatedById",
table: "UserCustomField",
column: "UpdatedById",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Users_Users_CreatedById",
table: "Users",
column: "CreatedById",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_Users_Users_UpdatedById",
table: "Users",
column: "UpdatedById",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Roles_Users_CreatedById",
table: "Roles");
migrationBuilder.DropForeignKey(
name: "FK_Roles_Users_UpdatedById",
table: "Roles");
migrationBuilder.DropForeignKey(
name: "FK_Roles_Users_UserId",
table: "Roles");
migrationBuilder.DropForeignKey(
name: "FK_UserCustomField_Users_CreatedById",
table: "UserCustomField");
migrationBuilder.DropForeignKey(
name: "FK_UserCustomField_Users_UpdatedById",
table: "UserCustomField");
migrationBuilder.DropForeignKey(
name: "FK_Users_Users_CreatedById",
table: "Users");
migrationBuilder.DropForeignKey(
name: "FK_Users_Users_UpdatedById",
table: "Users");
migrationBuilder.DropIndex(
name: "IX_Users_CreatedById",
table: "Users");
migrationBuilder.DropIndex(
name: "IX_Users_UpdatedById",
table: "Users");
migrationBuilder.DropIndex(
name: "IX_Roles_CreatedById",
table: "Roles");
migrationBuilder.DropIndex(
name: "IX_Roles_UpdatedById",
table: "Roles");
migrationBuilder.DropIndex(
name: "IX_Roles_UserId",
table: "Roles");
migrationBuilder.DropColumn(
name: "CreatedById",
table: "Users");
migrationBuilder.DropColumn(
name: "CreatedOn",
table: "Users");
migrationBuilder.DropColumn(
name: "UpdatedById",
table: "Users");
migrationBuilder.DropColumn(
name: "UpdatedOn",
table: "Users");
migrationBuilder.DropColumn(
name: "CreatedById",
table: "Roles");
migrationBuilder.DropColumn(
name: "CreatedOn",
table: "Roles");
migrationBuilder.DropColumn(
name: "UpdatedById",
table: "Roles");
migrationBuilder.DropColumn(
name: "UpdatedOn",
table: "Roles");
migrationBuilder.DropColumn(
name: "UserId",
table: "Roles");
migrationBuilder.AlterColumn<DateTime>(
name: "RefreshTokenExpiration",
table: "Users",
type: "TEXT",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "TEXT");
migrationBuilder.AlterColumn<bool>(
name: "Approved",
table: "Users",
type: "INTEGER",
nullable: true,
oldClrType: typeof(bool),
oldType: "INTEGER");
migrationBuilder.AddColumn<string>(
name: "Discriminator",
table: "Users",
type: "TEXT",
maxLength: 21,
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "Discriminator",
table: "Roles",
type: "TEXT",
maxLength: 21,
nullable: false,
defaultValue: "");
migrationBuilder.AddForeignKey(
name: "FK_UserCustomField_Users_CreatedById",
table: "UserCustomField",
column: "CreatedById",
principalTable: "Users",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_UserCustomField_Users_UpdatedById",
table: "UserCustomField",
column: "UpdatedById",
principalTable: "Users",
principalColumn: "Id");
}
}
}