using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MaBibli.Api.Data.Migrations
{
///
public partial class Revues : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Revues",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Titre = table.Column(type: "TEXT", nullable: false),
TitreNormalise = table.Column(type: "TEXT", nullable: false),
Issn = table.Column(type: "TEXT", nullable: true),
Editeur = table.Column(type: "TEXT", nullable: true),
DateAjout = table.Column(type: "TEXT", nullable: false),
AjoutePar = table.Column(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Revues", x => x.Id);
});
migrationBuilder.CreateTable(
name: "NumerosRevue",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
RevueId = table.Column(type: "INTEGER", nullable: false),
Numero = table.Column(type: "TEXT", nullable: false),
NumeroNormalise = table.Column(type: "TEXT", nullable: false),
DateParution = table.Column(type: "TEXT", nullable: true),
Note = table.Column(type: "TEXT", nullable: true),
DateAjout = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_NumerosRevue", x => x.Id);
table.ForeignKey(
name: "FK_NumerosRevue_Revues_RevueId",
column: x => x.RevueId,
principalTable: "Revues",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_NumerosRevue_RevueId_NumeroNormalise",
table: "NumerosRevue",
columns: new[] { "RevueId", "NumeroNormalise" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Revues_Issn",
table: "Revues",
column: "Issn",
unique: true,
filter: "\"Issn\" IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_Revues_TitreNormalise",
table: "Revues",
column: "TitreNormalise",
unique: true);
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "NumerosRevue");
migrationBuilder.DropTable(
name: "Revues");
}
}
}