using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace MaBibli.Api.Data.Migrations { /// public partial class InitialCreate : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Livres", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Isbn = table.Column(type: "TEXT", nullable: true), Titre = table.Column(type: "TEXT", nullable: false), Auteur = table.Column(type: "TEXT", nullable: true), Editeur = table.Column(type: "TEXT", nullable: true), Format = table.Column(type: "INTEGER", nullable: false), Statut = table.Column(type: "INTEGER", nullable: false), CoverUrl = 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_Livres", x => x.Id); }); migrationBuilder.CreateTable( name: "Prets", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), LivreId = table.Column(type: "INTEGER", nullable: false), Emprunteur = table.Column(type: "TEXT", nullable: false), DatePret = table.Column(type: "TEXT", nullable: false), DateRetour = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Prets", x => x.Id); table.ForeignKey( name: "FK_Prets_Livres_LivreId", column: x => x.LivreId, principalTable: "Livres", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Livres_Isbn", table: "Livres", column: "Isbn"); migrationBuilder.CreateIndex( name: "IX_Prets_LivreId", table: "Prets", column: "LivreId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Prets"); migrationBuilder.DropTable( name: "Livres"); } } }