using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace MaBibli.Api.Data.Migrations { /// public partial class ThemesEtEtiquettes : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Themes", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Nom = table.Column(type: "TEXT", nullable: false), NomNormalise = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Themes", x => x.Id); }); migrationBuilder.CreateTable( name: "LivreThemes", columns: table => new { LivreId = table.Column(type: "INTEGER", nullable: false), ThemeId = table.Column(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); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "LivreThemes"); migrationBuilder.DropTable( name: "Themes"); } } }