72 lines
2.2 KiB
C#
72 lines
2.2 KiB
C#
|
using System;
|
|||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
|
|||
|
#nullable disable
|
|||
|
|
|||
|
namespace Foxchat.Identity.Migrations
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
public partial class AddRedirectUris : Migration
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.DropForeignKey(
|
|||
|
name: "fk_tokens_accounts_account_id",
|
|||
|
table: "tokens");
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<Guid>(
|
|||
|
name: "account_id",
|
|||
|
table: "tokens",
|
|||
|
type: "uuid",
|
|||
|
nullable: true,
|
|||
|
oldClrType: typeof(Guid),
|
|||
|
oldType: "uuid");
|
|||
|
|
|||
|
migrationBuilder.AddColumn<string[]>(
|
|||
|
name: "redirect_uris",
|
|||
|
table: "applications",
|
|||
|
type: "text[]",
|
|||
|
nullable: false,
|
|||
|
defaultValue: new string[0]);
|
|||
|
|
|||
|
migrationBuilder.AddForeignKey(
|
|||
|
name: "fk_tokens_accounts_account_id",
|
|||
|
table: "tokens",
|
|||
|
column: "account_id",
|
|||
|
principalTable: "accounts",
|
|||
|
principalColumn: "id");
|
|||
|
}
|
|||
|
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.DropForeignKey(
|
|||
|
name: "fk_tokens_accounts_account_id",
|
|||
|
table: "tokens");
|
|||
|
|
|||
|
migrationBuilder.DropColumn(
|
|||
|
name: "redirect_uris",
|
|||
|
table: "applications");
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<Guid>(
|
|||
|
name: "account_id",
|
|||
|
table: "tokens",
|
|||
|
type: "uuid",
|
|||
|
nullable: false,
|
|||
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
|||
|
oldClrType: typeof(Guid),
|
|||
|
oldType: "uuid",
|
|||
|
oldNullable: true);
|
|||
|
|
|||
|
migrationBuilder.AddForeignKey(
|
|||
|
name: "fk_tokens_accounts_account_id",
|
|||
|
table: "tokens",
|
|||
|
column: "account_id",
|
|||
|
principalTable: "accounts",
|
|||
|
principalColumn: "id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|