using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace MyOffice.Migrations.Postgres.Migrations
{
    /// <inheritdoc />
    public partial class AccessOwner : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<Guid>(
                name: "OwnerId",
                table: "AccountAccesses",
                type: "uuid",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_AccountAccesses_OwnerId",
                table: "AccountAccesses",
                column: "OwnerId");

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

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

            migrationBuilder.DropIndex(
                name: "IX_AccountAccesses_OwnerId",
                table: "AccountAccesses");

            migrationBuilder.DropColumn(
                name: "OwnerId",
                table: "AccountAccesses");
        }
    }
}
