Ajoute les thèmes communs sur les fiches de livres

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
LIMONIER Mathieu
2026-08-20 14:38:19 +02:00
co-authored by Copilot
parent e28d5bce32
commit c2d408afc6
17 changed files with 992 additions and 8 deletions
@@ -0,0 +1,73 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MaBibli.Api.Data.Migrations
{
/// <inheritdoc />
public partial class ThemesEtEtiquettes : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Themes",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Nom = table.Column<string>(type: "TEXT", nullable: false),
NomNormalise = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Themes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "LivreThemes",
columns: table => new
{
LivreId = table.Column<int>(type: "INTEGER", nullable: false),
ThemeId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LivreThemes", x => new { x.LivreId, x.ThemeId });
table.ForeignKey(
name: "FK_LivreThemes_Livres_LivreId",
column: x => x.LivreId,
principalTable: "Livres",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_LivreThemes_Themes_ThemeId",
column: x => x.ThemeId,
principalTable: "Themes",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_LivreThemes_ThemeId",
table: "LivreThemes",
column: "ThemeId");
migrationBuilder.CreateIndex(
name: "IX_Themes_NomNormalise",
table: "Themes",
column: "NomNormalise",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "LivreThemes");
migrationBuilder.DropTable(
name: "Themes");
}
}
}