using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace MaBibli.Api.Data.Migrations
{
    /// <inheritdoc />
    public partial class ImagesEtUnesDesNumeros : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<string>(
                name: "CoverUrl",
                table: "NumerosRevue",
                type: "TEXT",
                nullable: true);

            migrationBuilder.CreateTable(
                name: "ArticlesUne",
                columns: table => new
                {
                    Id = table.Column<int>(type: "INTEGER", nullable: false)
                        .Annotation("Sqlite:Autoincrement", true),
                    NumeroRevueId = table.Column<int>(type: "INTEGER", nullable: false),
                    Titre = table.Column<string>(type: "TEXT", nullable: false),
                    TitreNormalise = table.Column<string>(type: "TEXT", nullable: false),
                    Position = table.Column<int>(type: "INTEGER", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ArticlesUne", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ArticlesUne_NumerosRevue_NumeroRevueId",
                        column: x => x.NumeroRevueId,
                        principalTable: "NumerosRevue",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_ArticlesUne_NumeroRevueId_TitreNormalise",
                table: "ArticlesUne",
                columns: new[] { "NumeroRevueId", "TitreNormalise" },
                unique: true);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "ArticlesUne");

            migrationBuilder.DropColumn(
                name: "CoverUrl",
                table: "NumerosRevue");
        }
    }
}
