using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace MyOffice.Migrations.Postgres.Migrations
{
    /// <inheritdoc />
    public partial class AccessOwner2 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_AccountAccesses_Users_OwnerId",
                table: "AccountAccesses");

            migrationBuilder.AlterColumn<Guid>(
                name: "OwnerId",
                table: "AccountAccesses",
                type: "uuid",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                oldClrType: typeof(Guid),
                oldType: "uuid",
                oldNullable: true);

            migrationBuilder.AddForeignKey(
                name: "FK_AccountAccesses_Users_OwnerId",
                table: "AccountAccesses",
                column: "OwnerId",
                principalTable: "Users",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_AccountAccesses_Users_OwnerId",
                table: "AccountAccesses");

            migrationBuilder.AlterColumn<Guid>(
                name: "OwnerId",
                table: "AccountAccesses",
                type: "uuid",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uuid");

            migrationBuilder.AddForeignKey(
                name: "FK_AccountAccesses_Users_OwnerId",
                table: "AccountAccesses",
                column: "OwnerId",
                principalTable: "Users",
                principalColumn: "Id");
        }
    }
}
