using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Knot.Modules.Stories.Migrations
{
    /// <inheritdoc />
    public partial class InitialStories : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.EnsureSchema(
                name: "stories");

            migrationBuilder.CreateTable(
                name: "StoryViewers",
                schema: "stories",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    StoryId = table.Column<Guid>(type: "uuid", nullable: false),
                    UserId = table.Column<Guid>(type: "uuid", nullable: false),
                    ViewedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StoryViewers", x => x.Id);
                });

            migrationBuilder.CreateIndex(
                name: "IX_StoryViewers_StoryId_UserId",
                schema: "stories",
                table: "StoryViewers",
                columns: new[] { "StoryId", "UserId" },
                unique: true);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "StoryViewers",
                schema: "stories");
        }
    }
}
