using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Blahblah.FlowerStory.Server.Migrations
{
    /// <inheritdoc />
    public partial class AddPhotoOwnerKey : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<int>(
                name: "uid",
                table: "photos",
                type: "INTEGER",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.CreateIndex(
                name: "IX_photos_uid",
                table: "photos",
                column: "uid");

            migrationBuilder.AddForeignKey(
                name: "FK_photos_users_uid",
                table: "photos",
                column: "uid",
                principalTable: "users",
                principalColumn: "uid",
                onDelete: ReferentialAction.Cascade);
        }

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

            migrationBuilder.DropIndex(
                name: "IX_photos_uid",
                table: "photos");

            migrationBuilder.DropColumn(
                name: "uid",
                table: "photos");
        }
    }
}
