diff --git a/CLAUDE.md b/CLAUDE.md index 9def96c..51d2d32 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -708,6 +708,70 @@ Compilation **locale**, puis dépôt manuel de l'archive en release sur le Gitea **Ne jamais compiler sur le serveur** à l'installation : cela imposerait le SDK .NET complet sur la machine YunoHost, pour une compilation lente — l'inverse exact de ce que permet le self-contained. +## ⚠️ Les migrations ont été FUSIONNÉES en une seule (2026-08-22) + +`MaBibli.Api/Data/Migrations/` ne contient plus qu'**une** migration, `InitialCreate`, +là où quinze se succédaient. Décidé avec l'utilisateur avant la sortie du projet. + +⚠️ **Ce fichier cite une dizaine de migrations par leur nom** — `StatutPersonnelEtTableAuteurs`, +`RangDesEnvies`, `TypeDeDocument`, `SagasEtCycles`, `Revues`, `RolesDesAuteurs`, +`ImagesEtUnesDesNumeros`, `NombreDePages`, `EnviesDeRevues`… **Ces noms n'existent plus +comme fichiers.** Ils restent utiles : ils datent une décision et disent dans quel ordre le +modèle s'est construit. Les lire comme de l'**histoire**, jamais comme des fichiers à ouvrir. + +### Ce que la fusion coûte, et qui était le prix à payer + +⚠️ **Aucune base antérieure n'est plus migrable.** `__EFMigrationsHistory` d'une +installation existante contient les quinze anciens noms ; au démarrage, EF Core verrait +`InitialCreate` non appliquée et tenterait de créer des tables déjà présentes. La mise à +jour échouerait, **et son retour arrière aussi**. + +**La seule voie sur un serveur déjà installé est donc `yunohost app remove mabibli --purge` +puis une réinstallation**, avec perte du catalogue. ⚠️ Sans le `--purge`, `data_dir` survit +(c'est documenté plus haut) et l'ancienne base revient avec son historique incompatible — +le symptôme serait alors incompréhensible. + +⚠️ **Deux SQL de reprise de données ont disparu avec leurs migrations** : +`StatutPersonnelEtTableAuteurs` (recopie de l'ancien `Statut` et de l'ancien `Auteur` +texte) et `RangDesEnvies` (reconduction de l'ordre d'affichage des envies). Sans objet sur +une base vierge, mais leur perte est définitive. `MigrationRangDesEnviesTests`, qui migrait +jusqu'à `ListeDEnvies` pour éprouver le second, a été supprimé : 628 tests → **626**. + +### La fusion a été vérifiée, pas supposée + +Le schéma des quinze migrations et celui de `InitialCreate` ont été appliqués sur deux +bases SQLite vierges, puis comparés : + +| | Résultat | +|---|---| +| Colonnes (nom, type, NOT NULL, PK) | **97 des deux côtés, aucun écart** | +| Index | **27 des deux côtés, aucun écart** | +| Clés étrangères et modes `ON DELETE` | **11 des deux côtés, aucun écart** | + +Les `SET NULL` d'`ElementsSerie.LivreId` et de `Series.SerieParenteId`, le `RESTRICT` de +`LivreAuteurs.AuteurId`, les trois index uniques **partiels** et les **deux** index qui +cohabitent sur `Prets.LivreId` sont tous préservés. + +⚠️ **Deux écarts subsistent, tous deux sans effet, et il faut savoir pourquoi** : + +- **l'ordre physique des colonnes** diffère — les colonnes ajoutées par `AddColumn` se + rangeaient en fin de table, elles sont maintenant à leur place logique. SQLite accède par + nom ; +- **les `DEFAULT 0`** de `Role`, `TypeDocument` et `Rang` ont disparu. Ils n'existaient que + pour remplir les lignes **déjà présentes** au moment de l'ajout de colonne. Sur une table + neuve il n'y a rien à remplir, et EF fournit toujours la valeur à l'insertion. ⚠️ En + revanche un `INSERT` en **SQL brut** omettant ces colonnes échouerait désormais — à savoir + si un test venait à en écrire un. + +Vérifié en exécution sur une base créée de zéro : 18 tables, l'unique migration inscrite +dans `__EFMigrationsHistory`, création d'un livre (201), recherche sans accents +(« emile » → « Émile Zola »), prêt (201), et second prêt **refusé** (400) — l'index unique +partiel tient. + +⚠️ **La base de développement garnie a été perdue** dans l'opération (son historique de +migrations était incompatible). Ce fichier la notait comme utile aux vérifications d'écran : +elle est à regarnir avant le prochain balayage. + ## Modèle de données Schéma en vigueur depuis la migration `StatutPersonnelEtTableAuteurs` (2026-08-18). diff --git a/MaBibli.Api/Data/Migrations/20260817195059_InitialCreate.Designer.cs b/MaBibli.Api/Data/Migrations/20260817195059_InitialCreate.Designer.cs deleted file mode 100644 index c9eb49d..0000000 --- a/MaBibli.Api/Data/Migrations/20260817195059_InitialCreate.Designer.cs +++ /dev/null @@ -1,108 +0,0 @@ -// -using System; -using MaBibli.Api.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - [DbContext(typeof(MaBibliDbContext))] - [Migration("20260817195059_InitialCreate")] - partial class InitialCreate - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "10.0.11"); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("Auteur") - .HasColumnType("TEXT"); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Format") - .HasColumnType("INTEGER"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Statut") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Isbn"); - - b.ToTable("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatePret") - .HasColumnType("TEXT"); - - b.Property("DateRetour") - .HasColumnType("TEXT"); - - b.Property("Emprunteur") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("LivreId"); - - b.ToTable("Prets"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Prets") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Navigation("Prets"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260817195059_InitialCreate.cs b/MaBibli.Api/Data/Migrations/20260817195059_InitialCreate.cs deleted file mode 100644 index 8de8b11..0000000 --- a/MaBibli.Api/Data/Migrations/20260817195059_InitialCreate.cs +++ /dev/null @@ -1,78 +0,0 @@ -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"); - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260818000335_StatutPersonnelEtTableAuteurs.Designer.cs b/MaBibli.Api/Data/Migrations/20260818000335_StatutPersonnelEtTableAuteurs.Designer.cs deleted file mode 100644 index 0cac4c6..0000000 --- a/MaBibli.Api/Data/Migrations/20260818000335_StatutPersonnelEtTableAuteurs.Designer.cs +++ /dev/null @@ -1,242 +0,0 @@ -// -using System; -using MaBibli.Api.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - [DbContext(typeof(MaBibliDbContext))] - [Migration("20260818000335_StatutPersonnelEtTableAuteurs")] - partial class StatutPersonnelEtTableAuteurs - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "10.0.11"); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CleRegroupement") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Nom") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NomNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CleRegroupement") - .IsUnique(); - - b.HasIndex("NomNormalise"); - - b.ToTable("Auteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Format") - .HasColumnType("INTEGER"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Isbn"); - - b.HasIndex("TitreNormalise"); - - b.ToTable("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("AuteurId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.HasKey("LivreId", "AuteurId"); - - b.HasIndex("AuteurId"); - - b.ToTable("LivreAuteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatePret") - .HasColumnType("TEXT"); - - b.Property("DateRetour") - .HasColumnType("TEXT"); - - b.Property("Emprunteur") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("LivreId"); - - b.ToTable("Prets"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.RapprochementRefuse", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AuteurAId") - .HasColumnType("INTEGER"); - - b.Property("AuteurBId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("AuteurAId", "AuteurBId") - .IsUnique(); - - b.ToTable("RapprochementsRefuses"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DateMaj") - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("Statut") - .HasColumnType("INTEGER"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Utilisateur"); - - b.HasIndex("LivreId", "Utilisateur") - .IsUnique(); - - b.ToTable("StatutsLecture"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.HasOne("MaBibli.Shared.Entites.Auteur", "Auteur") - .WithMany("Livres") - .HasForeignKey("AuteurId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Auteurs") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Auteur"); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Prets") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Statuts") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Navigation("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Navigation("Auteurs"); - - b.Navigation("Prets"); - - b.Navigation("Statuts"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260818000335_StatutPersonnelEtTableAuteurs.cs b/MaBibli.Api/Data/Migrations/20260818000335_StatutPersonnelEtTableAuteurs.cs deleted file mode 100644 index 5a20fac..0000000 --- a/MaBibli.Api/Data/Migrations/20260818000335_StatutPersonnelEtTableAuteurs.cs +++ /dev/null @@ -1,278 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - /// - /// Sort le statut de lecture et l'auteur de la table Livres. - /// - /// - /// Ce que deviennent les données existantes. - /// - /// - /// Livres.Statut était commun à tout le foyer. Il est rattaché à - /// AjoutePar, la seule personne que la base associe au livre. Les statuts des - /// livres sans AjoutePar (saisis sans identité) sont perdus : les attribuer à - /// quelqu'un serait une invention, et les garder pour tout le monde serait exactement le - /// défaut que cette migration corrige. Les trois valeurs sont reprises telles quelles, « À - /// lire » compris : c'est ce que l'ancienne interface affichait, et le taire changerait ce - /// que l'utilisateur voit. - /// - /// - /// Livres.Auteur devient une ligne de Auteurs par valeur distincte, plus un lien - /// en position 0. Le regroupement se fait ici sur une simple mise en minuscules — SQLite ne - /// sait pas retirer les accents. La normalisation complète, et la fusion des variantes qu'elle - /// révèle, sont faites en C# au démarrage suivant (voir ServiceRenormalisation). - /// - /// - /// L'ordre des opérations compte : tout est recopié avant que les anciennes colonnes - /// ne soient supprimées. - /// - public partial class StatutPersonnelEtTableAuteurs : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - // Mise à l'abri du contenu des deux colonnes condamnées. Supprimer une colonne sous - // SQLite reconstruit la table : on le fait pendant que Livres n'a pas encore - // d'enfants à préserver, et on recopie ensuite depuis cette table de transit. - migrationBuilder.Sql( - """ - CREATE TABLE _RepriseLivres AS - SELECT Id, Auteur, Statut FROM Livres; - """); - - migrationBuilder.DropColumn( - name: "Auteur", - table: "Livres"); - - migrationBuilder.DropColumn( - name: "Statut", - table: "Livres"); - - migrationBuilder.AddColumn( - name: "TitreNormalise", - table: "Livres", - type: "TEXT", - nullable: false, - defaultValue: ""); - - migrationBuilder.CreateTable( - name: "Auteurs", - 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), - CleRegroupement = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Auteurs", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "RapprochementsRefuses", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - AuteurAId = table.Column(type: "INTEGER", nullable: false), - AuteurBId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_RapprochementsRefuses", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "StatutsLecture", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - LivreId = table.Column(type: "INTEGER", nullable: false), - Utilisateur = table.Column(type: "TEXT", nullable: false), - Statut = table.Column(type: "INTEGER", nullable: false), - DateMaj = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_StatutsLecture", x => x.Id); - table.ForeignKey( - name: "FK_StatutsLecture_Livres_LivreId", - column: x => x.LivreId, - principalTable: "Livres", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "LivreAuteurs", - columns: table => new - { - LivreId = table.Column(type: "INTEGER", nullable: false), - AuteurId = table.Column(type: "INTEGER", nullable: false), - Position = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_LivreAuteurs", x => new { x.LivreId, x.AuteurId }); - table.ForeignKey( - name: "FK_LivreAuteurs_Auteurs_AuteurId", - column: x => x.AuteurId, - principalTable: "Auteurs", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_LivreAuteurs_Livres_LivreId", - column: x => x.LivreId, - principalTable: "Livres", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Livres_TitreNormalise", - table: "Livres", - column: "TitreNormalise"); - - migrationBuilder.CreateIndex( - name: "IX_Auteurs_CleRegroupement", - table: "Auteurs", - column: "CleRegroupement", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Auteurs_NomNormalise", - table: "Auteurs", - column: "NomNormalise"); - - migrationBuilder.CreateIndex( - name: "IX_LivreAuteurs_AuteurId", - table: "LivreAuteurs", - column: "AuteurId"); - - migrationBuilder.CreateIndex( - name: "IX_RapprochementsRefuses_AuteurAId_AuteurBId", - table: "RapprochementsRefuses", - columns: new[] { "AuteurAId", "AuteurBId" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_StatutsLecture_LivreId_Utilisateur", - table: "StatutsLecture", - columns: new[] { "LivreId", "Utilisateur" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_StatutsLecture_Utilisateur", - table: "StatutsLecture", - column: "Utilisateur"); - - // ── Reprise des données depuis la table de transit ────────────────────────────── - - // Le titre normalisé n'est qu'approché ici (lower() de SQLite ne touche pas aux - // accents) ; le passage C# du démarrage le recalculera correctement. - migrationBuilder.Sql("UPDATE Livres SET TitreNormalise = lower(trim(Titre));"); - - // Une fiche auteur par valeur distincte, à la casse près. Le nom d'affichage retenu - // est le premier dans l'ordre alphabétique : arbitraire, mais déterministe, et - // l'utilisateur peut le corriger depuis n'importe quel livre. - migrationBuilder.Sql( - """ - INSERT INTO Auteurs (Nom, NomNormalise, CleRegroupement) - SELECT min(trim(Auteur)), lower(trim(Auteur)), lower(trim(Auteur)) - FROM _RepriseLivres - WHERE Auteur IS NOT NULL AND trim(Auteur) <> '' - GROUP BY lower(trim(Auteur)); - """); - - migrationBuilder.Sql( - """ - INSERT INTO LivreAuteurs (LivreId, AuteurId, Position) - SELECT r.Id, a.Id, 0 - FROM _RepriseLivres r - JOIN Auteurs a ON a.CleRegroupement = lower(trim(r.Auteur)) - JOIN Livres l ON l.Id = r.Id - WHERE r.Auteur IS NOT NULL AND trim(r.Auteur) <> ''; - """); - - // Le statut commun devient celui de la personne qui a saisi le livre. Sans AjoutePar, - // il n'y a personne à qui l'attribuer : la ligne n'est pas créée. - migrationBuilder.Sql( - """ - INSERT INTO StatutsLecture (LivreId, Utilisateur, Statut, DateMaj) - SELECT l.Id, trim(l.AjoutePar), r.Statut, l.DateAjout - FROM Livres l - JOIN _RepriseLivres r ON r.Id = l.Id - WHERE l.AjoutePar IS NOT NULL AND trim(l.AjoutePar) <> ''; - """); - - migrationBuilder.Sql("DROP TABLE _RepriseLivres;"); - } - - /// - /// - /// Retour en arrière. Une partie de l'information est perdue par nature : l'ancien - /// modèle n'a qu'une case pour un auteur et une pour un statut. On y remet le premier - /// auteur et le statut de AjoutePar ; les co-auteurs et les statuts des autres - /// membres du foyer disparaissent. - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Auteur", - table: "Livres", - type: "TEXT", - nullable: true); - - migrationBuilder.AddColumn( - name: "Statut", - table: "Livres", - type: "INTEGER", - nullable: false, - defaultValue: 0); - - migrationBuilder.Sql( - """ - UPDATE Livres SET Auteur = ( - SELECT a.Nom FROM LivreAuteurs la - JOIN Auteurs a ON a.Id = la.AuteurId - WHERE la.LivreId = Livres.Id - ORDER BY la.Position LIMIT 1); - """); - - migrationBuilder.Sql( - """ - UPDATE Livres SET Statut = coalesce(( - SELECT s.Statut FROM StatutsLecture s - WHERE s.LivreId = Livres.Id AND s.Utilisateur = trim(Livres.AjoutePar) - LIMIT 1), 0); - """); - - migrationBuilder.DropTable( - name: "LivreAuteurs"); - - migrationBuilder.DropTable( - name: "RapprochementsRefuses"); - - migrationBuilder.DropTable( - name: "StatutsLecture"); - - migrationBuilder.DropTable( - name: "Auteurs"); - - migrationBuilder.DropIndex( - name: "IX_Livres_TitreNormalise", - table: "Livres"); - - migrationBuilder.DropColumn( - name: "TitreNormalise", - table: "Livres"); - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260818003150_IndexPretEnCours.Designer.cs b/MaBibli.Api/Data/Migrations/20260818003150_IndexPretEnCours.Designer.cs deleted file mode 100644 index dcbb3bb..0000000 --- a/MaBibli.Api/Data/Migrations/20260818003150_IndexPretEnCours.Designer.cs +++ /dev/null @@ -1,246 +0,0 @@ -// -using System; -using MaBibli.Api.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - [DbContext(typeof(MaBibliDbContext))] - [Migration("20260818003150_IndexPretEnCours")] - partial class IndexPretEnCours - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "10.0.11"); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CleRegroupement") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Nom") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NomNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CleRegroupement") - .IsUnique(); - - b.HasIndex("NomNormalise"); - - b.ToTable("Auteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Format") - .HasColumnType("INTEGER"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Isbn"); - - b.HasIndex("TitreNormalise"); - - b.ToTable("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("AuteurId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.HasKey("LivreId", "AuteurId"); - - b.HasIndex("AuteurId"); - - b.ToTable("LivreAuteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatePret") - .HasColumnType("TEXT"); - - b.Property("DateRetour") - .HasColumnType("TEXT"); - - b.Property("Emprunteur") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId_EnCours") - .IsUnique() - .HasFilter("\"DateRetour\" IS NULL"); - - b.ToTable("Prets"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.RapprochementRefuse", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AuteurAId") - .HasColumnType("INTEGER"); - - b.Property("AuteurBId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("AuteurAId", "AuteurBId") - .IsUnique(); - - b.ToTable("RapprochementsRefuses"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DateMaj") - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("Statut") - .HasColumnType("INTEGER"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Utilisateur"); - - b.HasIndex("LivreId", "Utilisateur") - .IsUnique(); - - b.ToTable("StatutsLecture"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.HasOne("MaBibli.Shared.Entites.Auteur", "Auteur") - .WithMany("Livres") - .HasForeignKey("AuteurId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Auteurs") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Auteur"); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Prets") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Statuts") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Navigation("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Navigation("Auteurs"); - - b.Navigation("Prets"); - - b.Navigation("Statuts"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260818003150_IndexPretEnCours.cs b/MaBibli.Api/Data/Migrations/20260818003150_IndexPretEnCours.cs deleted file mode 100644 index 2952e0a..0000000 --- a/MaBibli.Api/Data/Migrations/20260818003150_IndexPretEnCours.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - /// - public partial class IndexPretEnCours : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateIndex( - name: "IX_Prets_LivreId_EnCours", - table: "Prets", - column: "LivreId", - unique: true, - filter: "\"DateRetour\" IS NULL"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_Prets_LivreId_EnCours", - table: "Prets"); - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260818052834_ListeDEnvies.Designer.cs b/MaBibli.Api/Data/Migrations/20260818052834_ListeDEnvies.Designer.cs deleted file mode 100644 index ce19c4d..0000000 --- a/MaBibli.Api/Data/Migrations/20260818052834_ListeDEnvies.Designer.cs +++ /dev/null @@ -1,301 +0,0 @@ -// -using System; -using MaBibli.Api.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - [DbContext(typeof(MaBibliDbContext))] - [Migration("20260818052834_ListeDEnvies")] - partial class ListeDEnvies - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "10.0.11"); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CleRegroupement") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Nom") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NomNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CleRegroupement") - .IsUnique(); - - b.HasIndex("NomNormalise"); - - b.ToTable("Auteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Format") - .HasColumnType("INTEGER"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Isbn"); - - b.HasIndex("TitreNormalise"); - - b.ToTable("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("AuteurId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.HasKey("LivreId", "AuteurId"); - - b.HasIndex("AuteurId"); - - b.ToTable("LivreAuteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreSouhaite", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Annee") - .HasColumnType("TEXT"); - - b.Property("Auteur") - .HasColumnType("TEXT"); - - b.Property("AuteurNormalise") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasDefaultValue(""); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Note") - .HasColumnType("TEXT"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "Utilisateur" }, "IX_LivresSouhaites_Utilisateur"); - - b.HasIndex(new[] { "Utilisateur", "TitreNormalise", "AuteurNormalise" }, "IX_LivresSouhaites_Utilisateur_Oeuvre") - .IsUnique(); - - b.ToTable("LivresSouhaites"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatePret") - .HasColumnType("TEXT"); - - b.Property("DateRetour") - .HasColumnType("TEXT"); - - b.Property("Emprunteur") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId_EnCours") - .IsUnique() - .HasFilter("\"DateRetour\" IS NULL"); - - b.ToTable("Prets"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.RapprochementRefuse", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AuteurAId") - .HasColumnType("INTEGER"); - - b.Property("AuteurBId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("AuteurAId", "AuteurBId") - .IsUnique(); - - b.ToTable("RapprochementsRefuses"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DateMaj") - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("Statut") - .HasColumnType("INTEGER"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Utilisateur"); - - b.HasIndex("LivreId", "Utilisateur") - .IsUnique(); - - b.ToTable("StatutsLecture"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.HasOne("MaBibli.Shared.Entites.Auteur", "Auteur") - .WithMany("Livres") - .HasForeignKey("AuteurId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Auteurs") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Auteur"); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Prets") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Statuts") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Navigation("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Navigation("Auteurs"); - - b.Navigation("Prets"); - - b.Navigation("Statuts"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260818052834_ListeDEnvies.cs b/MaBibli.Api/Data/Migrations/20260818052834_ListeDEnvies.cs deleted file mode 100644 index ac731db..0000000 --- a/MaBibli.Api/Data/Migrations/20260818052834_ListeDEnvies.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - /// - public partial class ListeDEnvies : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "LivresSouhaites", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Utilisateur = table.Column(type: "TEXT", nullable: false), - Titre = table.Column(type: "TEXT", nullable: false), - TitreNormalise = table.Column(type: "TEXT", nullable: false), - Auteur = table.Column(type: "TEXT", nullable: true), - AuteurNormalise = table.Column(type: "TEXT", nullable: false, defaultValue: ""), - Editeur = table.Column(type: "TEXT", nullable: true), - Annee = table.Column(type: "TEXT", nullable: true), - Isbn = table.Column(type: "TEXT", nullable: true), - CoverUrl = 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_LivresSouhaites", x => x.Id); - }); - - migrationBuilder.CreateIndex( - name: "IX_LivresSouhaites_Utilisateur", - table: "LivresSouhaites", - column: "Utilisateur"); - - migrationBuilder.CreateIndex( - name: "IX_LivresSouhaites_Utilisateur_Oeuvre", - table: "LivresSouhaites", - columns: new[] { "Utilisateur", "TitreNormalise", "AuteurNormalise" }, - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "LivresSouhaites"); - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260818213512_RangDesEnvies.Designer.cs b/MaBibli.Api/Data/Migrations/20260818213512_RangDesEnvies.Designer.cs deleted file mode 100644 index 0044516..0000000 --- a/MaBibli.Api/Data/Migrations/20260818213512_RangDesEnvies.Designer.cs +++ /dev/null @@ -1,304 +0,0 @@ -// -using System; -using MaBibli.Api.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - [DbContext(typeof(MaBibliDbContext))] - [Migration("20260818213512_RangDesEnvies")] - partial class RangDesEnvies - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "10.0.11"); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CleRegroupement") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Nom") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NomNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CleRegroupement") - .IsUnique(); - - b.HasIndex("NomNormalise"); - - b.ToTable("Auteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Format") - .HasColumnType("INTEGER"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Isbn"); - - b.HasIndex("TitreNormalise"); - - b.ToTable("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("AuteurId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.HasKey("LivreId", "AuteurId"); - - b.HasIndex("AuteurId"); - - b.ToTable("LivreAuteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreSouhaite", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Annee") - .HasColumnType("TEXT"); - - b.Property("Auteur") - .HasColumnType("TEXT"); - - b.Property("AuteurNormalise") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasDefaultValue(""); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Note") - .HasColumnType("TEXT"); - - b.Property("Rang") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "Utilisateur" }, "IX_LivresSouhaites_Utilisateur"); - - b.HasIndex(new[] { "Utilisateur", "TitreNormalise", "AuteurNormalise" }, "IX_LivresSouhaites_Utilisateur_Oeuvre") - .IsUnique(); - - b.ToTable("LivresSouhaites"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatePret") - .HasColumnType("TEXT"); - - b.Property("DateRetour") - .HasColumnType("TEXT"); - - b.Property("Emprunteur") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId_EnCours") - .IsUnique() - .HasFilter("\"DateRetour\" IS NULL"); - - b.ToTable("Prets"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.RapprochementRefuse", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AuteurAId") - .HasColumnType("INTEGER"); - - b.Property("AuteurBId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("AuteurAId", "AuteurBId") - .IsUnique(); - - b.ToTable("RapprochementsRefuses"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DateMaj") - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("Statut") - .HasColumnType("INTEGER"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Utilisateur"); - - b.HasIndex("LivreId", "Utilisateur") - .IsUnique(); - - b.ToTable("StatutsLecture"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.HasOne("MaBibli.Shared.Entites.Auteur", "Auteur") - .WithMany("Livres") - .HasForeignKey("AuteurId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Auteurs") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Auteur"); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Prets") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Statuts") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Navigation("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Navigation("Auteurs"); - - b.Navigation("Prets"); - - b.Navigation("Statuts"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260818213512_RangDesEnvies.cs b/MaBibli.Api/Data/Migrations/20260818213512_RangDesEnvies.cs deleted file mode 100644 index 449d8a1..0000000 --- a/MaBibli.Api/Data/Migrations/20260818213512_RangDesEnvies.cs +++ /dev/null @@ -1,65 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - /// - /// Ajoute le rang manuel de la liste d'envies (du plus désiré au moins désiré). - /// - /// - /// ⚠️ La colonne seule ne suffit pas : à 0 partout, l'ordre retomberait sur l'Id, - /// c'est-à-dire l'ordre d'ajout, et les listes existantes se réordonneraient sous les yeux - /// de leur propriétaire sans qu'il ait rien demandé. Le remplissage ci-dessous reconduit - /// exactement l'ordre affiché jusqu'ici — auteurs renseignés d'abord, puis par auteur, - /// puis par titre — de sorte que la mise à jour ne se voie pas. - /// - /// Le rang est personnel, comme toute la table : la numérotation repart de zéro pour - /// chaque Utilisateur, d'où la corrélation sur cette colonne dans la sous-requête. - /// - /// - public partial class RangDesEnvies : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Rang", - table: "LivresSouhaites", - type: "INTEGER", - nullable: false, - defaultValue: 0); - - // Row values (a, b) < (c, d) : SQLite les gère depuis la 3.15, et c'est ce qui - // permet d'exprimer « combien de lignes se classaient avant celle-ci » en une - // seule comparaison lexicographique. L'Id ferme le tri : sans lui, deux envies - // de même auteur et même titre recevraient le même rang. - migrationBuilder.Sql(""" - UPDATE LivresSouhaites SET Rang = ( - SELECT COUNT(*) - FROM LivresSouhaites AS autre - WHERE autre.Utilisateur = LivresSouhaites.Utilisateur - AND ( - CASE WHEN autre.AuteurNormalise = '' THEN 1 ELSE 0 END, - autre.AuteurNormalise, - autre.TitreNormalise, - autre.Id - ) < ( - CASE WHEN LivresSouhaites.AuteurNormalise = '' THEN 1 ELSE 0 END, - LivresSouhaites.AuteurNormalise, - LivresSouhaites.TitreNormalise, - LivresSouhaites.Id - ) - ); - """); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Rang", - table: "LivresSouhaites"); - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260819194040_TypeDeDocument.Designer.cs b/MaBibli.Api/Data/Migrations/20260819194040_TypeDeDocument.Designer.cs deleted file mode 100644 index 56e47ab..0000000 --- a/MaBibli.Api/Data/Migrations/20260819194040_TypeDeDocument.Designer.cs +++ /dev/null @@ -1,307 +0,0 @@ -// -using System; -using MaBibli.Api.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - [DbContext(typeof(MaBibliDbContext))] - [Migration("20260819194040_TypeDeDocument")] - partial class TypeDeDocument - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "10.0.11"); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CleRegroupement") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Nom") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NomNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CleRegroupement") - .IsUnique(); - - b.HasIndex("NomNormalise"); - - b.ToTable("Auteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Format") - .HasColumnType("INTEGER"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TypeDocument") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Isbn"); - - b.HasIndex("TitreNormalise"); - - b.ToTable("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("AuteurId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.HasKey("LivreId", "AuteurId"); - - b.HasIndex("AuteurId"); - - b.ToTable("LivreAuteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreSouhaite", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Annee") - .HasColumnType("TEXT"); - - b.Property("Auteur") - .HasColumnType("TEXT"); - - b.Property("AuteurNormalise") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasDefaultValue(""); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Note") - .HasColumnType("TEXT"); - - b.Property("Rang") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "Utilisateur" }, "IX_LivresSouhaites_Utilisateur"); - - b.HasIndex(new[] { "Utilisateur", "TitreNormalise", "AuteurNormalise" }, "IX_LivresSouhaites_Utilisateur_Oeuvre") - .IsUnique(); - - b.ToTable("LivresSouhaites"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatePret") - .HasColumnType("TEXT"); - - b.Property("DateRetour") - .HasColumnType("TEXT"); - - b.Property("Emprunteur") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId_EnCours") - .IsUnique() - .HasFilter("\"DateRetour\" IS NULL"); - - b.ToTable("Prets"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.RapprochementRefuse", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AuteurAId") - .HasColumnType("INTEGER"); - - b.Property("AuteurBId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("AuteurAId", "AuteurBId") - .IsUnique(); - - b.ToTable("RapprochementsRefuses"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DateMaj") - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("Statut") - .HasColumnType("INTEGER"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Utilisateur"); - - b.HasIndex("LivreId", "Utilisateur") - .IsUnique(); - - b.ToTable("StatutsLecture"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.HasOne("MaBibli.Shared.Entites.Auteur", "Auteur") - .WithMany("Livres") - .HasForeignKey("AuteurId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Auteurs") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Auteur"); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Prets") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Statuts") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Navigation("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Navigation("Auteurs"); - - b.Navigation("Prets"); - - b.Navigation("Statuts"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260819194040_TypeDeDocument.cs b/MaBibli.Api/Data/Migrations/20260819194040_TypeDeDocument.cs deleted file mode 100644 index 6b42a17..0000000 --- a/MaBibli.Api/Data/Migrations/20260819194040_TypeDeDocument.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - /// - /// Ajoute le type de document, à « non précisé » pour tout l'existant. - /// - /// - /// ⚠️ Contrairement à RangDesEnvies, cette migration se réduit bien à un - /// AddColumn, et c'est le choix de la valeur par défaut qui l'explique : 0 vaut - /// NonPrecise, c'est-à-dire « on ne sait pas ». Si le défaut avait été « Roman », il - /// aurait fallu écrire quelque chose de faux sur chaque fiche existante — ou renoncer au - /// défaut. Rien à reprendre, donc rien à deviner. - /// - public partial class TypeDeDocument : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "TypeDocument", - table: "Livres", - type: "INTEGER", - nullable: false, - defaultValue: 0); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "TypeDocument", - table: "Livres"); - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260819195104_SagasEtCycles.Designer.cs b/MaBibli.Api/Data/Migrations/20260819195104_SagasEtCycles.Designer.cs deleted file mode 100644 index 7335d9e..0000000 --- a/MaBibli.Api/Data/Migrations/20260819195104_SagasEtCycles.Designer.cs +++ /dev/null @@ -1,410 +0,0 @@ -// -using System; -using MaBibli.Api.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - [DbContext(typeof(MaBibliDbContext))] - [Migration("20260819195104_SagasEtCycles")] - partial class SagasEtCycles - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "10.0.11"); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CleRegroupement") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Nom") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NomNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CleRegroupement") - .IsUnique(); - - b.HasIndex("NomNormalise"); - - b.ToTable("Auteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.ElementSerie", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("SerieId") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("LivreId"); - - b.HasIndex(new[] { "SerieId" }, "IX_ElementsSerie_SerieId"); - - b.HasIndex(new[] { "SerieId", "LivreId" }, "IX_ElementsSerie_SerieId_LivreId") - .IsUnique() - .HasFilter("\"LivreId\" IS NOT NULL"); - - b.ToTable("ElementsSerie"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Format") - .HasColumnType("INTEGER"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TypeDocument") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Isbn"); - - b.HasIndex("TitreNormalise"); - - b.ToTable("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("AuteurId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.HasKey("LivreId", "AuteurId"); - - b.HasIndex("AuteurId"); - - b.ToTable("LivreAuteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreSouhaite", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Annee") - .HasColumnType("TEXT"); - - b.Property("Auteur") - .HasColumnType("TEXT"); - - b.Property("AuteurNormalise") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasDefaultValue(""); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Note") - .HasColumnType("TEXT"); - - b.Property("Rang") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "Utilisateur" }, "IX_LivresSouhaites_Utilisateur"); - - b.HasIndex(new[] { "Utilisateur", "TitreNormalise", "AuteurNormalise" }, "IX_LivresSouhaites_Utilisateur_Oeuvre") - .IsUnique(); - - b.ToTable("LivresSouhaites"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatePret") - .HasColumnType("TEXT"); - - b.Property("DateRetour") - .HasColumnType("TEXT"); - - b.Property("Emprunteur") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId_EnCours") - .IsUnique() - .HasFilter("\"DateRetour\" IS NULL"); - - b.ToTable("Prets"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.RapprochementRefuse", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AuteurAId") - .HasColumnType("INTEGER"); - - b.Property("AuteurBId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("AuteurAId", "AuteurBId") - .IsUnique(); - - b.ToTable("RapprochementsRefuses"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("SerieParenteId") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("SerieParenteId"); - - b.HasIndex("TitreNormalise") - .IsUnique(); - - b.ToTable("Series"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DateMaj") - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("Statut") - .HasColumnType("INTEGER"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Utilisateur"); - - b.HasIndex("LivreId", "Utilisateur") - .IsUnique(); - - b.ToTable("StatutsLecture"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.ElementSerie", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany() - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("MaBibli.Shared.Entites.Serie", "Serie") - .WithMany("Elements") - .HasForeignKey("SerieId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - - b.Navigation("Serie"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.HasOne("MaBibli.Shared.Entites.Auteur", "Auteur") - .WithMany("Livres") - .HasForeignKey("AuteurId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Auteurs") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Auteur"); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Prets") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.HasOne("MaBibli.Shared.Entites.Serie", "SerieParente") - .WithMany("SousSeries") - .HasForeignKey("SerieParenteId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("SerieParente"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Statuts") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Navigation("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Navigation("Auteurs"); - - b.Navigation("Prets"); - - b.Navigation("Statuts"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.Navigation("Elements"); - - b.Navigation("SousSeries"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260819195104_SagasEtCycles.cs b/MaBibli.Api/Data/Migrations/20260819195104_SagasEtCycles.cs deleted file mode 100644 index 62d0984..0000000 --- a/MaBibli.Api/Data/Migrations/20260819195104_SagasEtCycles.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - /// - public partial class SagasEtCycles : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Series", - 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), - SerieParenteId = table.Column(type: "INTEGER", nullable: true), - Position = table.Column(type: "INTEGER", nullable: false), - DateAjout = table.Column(type: "TEXT", nullable: false), - AjoutePar = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Series", x => x.Id); - table.ForeignKey( - name: "FK_Series_Series_SerieParenteId", - column: x => x.SerieParenteId, - principalTable: "Series", - principalColumn: "Id", - onDelete: ReferentialAction.SetNull); - }); - - migrationBuilder.CreateTable( - name: "ElementsSerie", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - SerieId = table.Column(type: "INTEGER", nullable: false), - Position = table.Column(type: "INTEGER", nullable: false), - LivreId = table.Column(type: "INTEGER", nullable: true), - Titre = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ElementsSerie", x => x.Id); - table.ForeignKey( - name: "FK_ElementsSerie_Livres_LivreId", - column: x => x.LivreId, - principalTable: "Livres", - principalColumn: "Id", - onDelete: ReferentialAction.SetNull); - table.ForeignKey( - name: "FK_ElementsSerie_Series_SerieId", - column: x => x.SerieId, - principalTable: "Series", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_ElementsSerie_LivreId", - table: "ElementsSerie", - column: "LivreId"); - - migrationBuilder.CreateIndex( - name: "IX_ElementsSerie_SerieId", - table: "ElementsSerie", - column: "SerieId"); - - migrationBuilder.CreateIndex( - name: "IX_ElementsSerie_SerieId_LivreId", - table: "ElementsSerie", - columns: new[] { "SerieId", "LivreId" }, - unique: true, - filter: "\"LivreId\" IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "IX_Series_SerieParenteId", - table: "Series", - column: "SerieParenteId"); - - migrationBuilder.CreateIndex( - name: "IX_Series_TitreNormalise", - table: "Series", - column: "TitreNormalise", - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ElementsSerie"); - - migrationBuilder.DropTable( - name: "Series"); - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260819201008_Revues.Designer.cs b/MaBibli.Api/Data/Migrations/20260819201008_Revues.Designer.cs deleted file mode 100644 index fe45520..0000000 --- a/MaBibli.Api/Data/Migrations/20260819201008_Revues.Designer.cs +++ /dev/null @@ -1,498 +0,0 @@ -// -using System; -using MaBibli.Api.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - [DbContext(typeof(MaBibliDbContext))] - [Migration("20260819201008_Revues")] - partial class Revues - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "10.0.11"); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CleRegroupement") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Nom") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NomNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CleRegroupement") - .IsUnique(); - - b.HasIndex("NomNormalise"); - - b.ToTable("Auteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.ElementSerie", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("SerieId") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("LivreId"); - - b.HasIndex(new[] { "SerieId" }, "IX_ElementsSerie_SerieId"); - - b.HasIndex(new[] { "SerieId", "LivreId" }, "IX_ElementsSerie_SerieId_LivreId") - .IsUnique() - .HasFilter("\"LivreId\" IS NOT NULL"); - - b.ToTable("ElementsSerie"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Format") - .HasColumnType("INTEGER"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TypeDocument") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Isbn"); - - b.HasIndex("TitreNormalise"); - - b.ToTable("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("AuteurId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.HasKey("LivreId", "AuteurId"); - - b.HasIndex("AuteurId"); - - b.ToTable("LivreAuteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreSouhaite", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Annee") - .HasColumnType("TEXT"); - - b.Property("Auteur") - .HasColumnType("TEXT"); - - b.Property("AuteurNormalise") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasDefaultValue(""); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Note") - .HasColumnType("TEXT"); - - b.Property("Rang") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "Utilisateur" }, "IX_LivresSouhaites_Utilisateur"); - - b.HasIndex(new[] { "Utilisateur", "TitreNormalise", "AuteurNormalise" }, "IX_LivresSouhaites_Utilisateur_Oeuvre") - .IsUnique(); - - b.ToTable("LivresSouhaites"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.NumeroRevue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("DateParution") - .HasColumnType("TEXT"); - - b.Property("Note") - .HasColumnType("TEXT"); - - b.Property("Numero") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NumeroNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("RevueId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RevueId", "NumeroNormalise") - .IsUnique(); - - b.ToTable("NumerosRevue"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatePret") - .HasColumnType("TEXT"); - - b.Property("DateRetour") - .HasColumnType("TEXT"); - - b.Property("Emprunteur") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId_EnCours") - .IsUnique() - .HasFilter("\"DateRetour\" IS NULL"); - - b.ToTable("Prets"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.RapprochementRefuse", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AuteurAId") - .HasColumnType("INTEGER"); - - b.Property("AuteurBId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("AuteurAId", "AuteurBId") - .IsUnique(); - - b.ToTable("RapprochementsRefuses"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Revue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Issn") - .HasColumnType("TEXT"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("TitreNormalise") - .IsUnique(); - - b.HasIndex(new[] { "Issn" }, "IX_Revues_Issn") - .IsUnique() - .HasFilter("\"Issn\" IS NOT NULL"); - - b.ToTable("Revues"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("SerieParenteId") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("SerieParenteId"); - - b.HasIndex("TitreNormalise") - .IsUnique(); - - b.ToTable("Series"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DateMaj") - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("Statut") - .HasColumnType("INTEGER"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Utilisateur"); - - b.HasIndex("LivreId", "Utilisateur") - .IsUnique(); - - b.ToTable("StatutsLecture"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.ElementSerie", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany() - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("MaBibli.Shared.Entites.Serie", "Serie") - .WithMany("Elements") - .HasForeignKey("SerieId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - - b.Navigation("Serie"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.HasOne("MaBibli.Shared.Entites.Auteur", "Auteur") - .WithMany("Livres") - .HasForeignKey("AuteurId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Auteurs") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Auteur"); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.NumeroRevue", b => - { - b.HasOne("MaBibli.Shared.Entites.Revue", "Revue") - .WithMany("Numeros") - .HasForeignKey("RevueId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Revue"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Prets") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.HasOne("MaBibli.Shared.Entites.Serie", "SerieParente") - .WithMany("SousSeries") - .HasForeignKey("SerieParenteId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("SerieParente"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Statuts") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Navigation("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Navigation("Auteurs"); - - b.Navigation("Prets"); - - b.Navigation("Statuts"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Revue", b => - { - b.Navigation("Numeros"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.Navigation("Elements"); - - b.Navigation("SousSeries"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260819201008_Revues.cs b/MaBibli.Api/Data/Migrations/20260819201008_Revues.cs deleted file mode 100644 index aafbcee..0000000 --- a/MaBibli.Api/Data/Migrations/20260819201008_Revues.cs +++ /dev/null @@ -1,86 +0,0 @@ -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"); - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260819203118_RolesDesAuteurs.Designer.cs b/MaBibli.Api/Data/Migrations/20260819203118_RolesDesAuteurs.Designer.cs deleted file mode 100644 index d50df71..0000000 --- a/MaBibli.Api/Data/Migrations/20260819203118_RolesDesAuteurs.Designer.cs +++ /dev/null @@ -1,501 +0,0 @@ -// -using System; -using MaBibli.Api.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - [DbContext(typeof(MaBibliDbContext))] - [Migration("20260819203118_RolesDesAuteurs")] - partial class RolesDesAuteurs - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "10.0.11"); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CleRegroupement") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Nom") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NomNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CleRegroupement") - .IsUnique(); - - b.HasIndex("NomNormalise"); - - b.ToTable("Auteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.ElementSerie", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("SerieId") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("LivreId"); - - b.HasIndex(new[] { "SerieId" }, "IX_ElementsSerie_SerieId"); - - b.HasIndex(new[] { "SerieId", "LivreId" }, "IX_ElementsSerie_SerieId_LivreId") - .IsUnique() - .HasFilter("\"LivreId\" IS NOT NULL"); - - b.ToTable("ElementsSerie"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Format") - .HasColumnType("INTEGER"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TypeDocument") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Isbn"); - - b.HasIndex("TitreNormalise"); - - b.ToTable("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("AuteurId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("Role") - .HasColumnType("INTEGER"); - - b.HasKey("LivreId", "AuteurId"); - - b.HasIndex("AuteurId"); - - b.ToTable("LivreAuteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreSouhaite", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Annee") - .HasColumnType("TEXT"); - - b.Property("Auteur") - .HasColumnType("TEXT"); - - b.Property("AuteurNormalise") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasDefaultValue(""); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Note") - .HasColumnType("TEXT"); - - b.Property("Rang") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "Utilisateur" }, "IX_LivresSouhaites_Utilisateur"); - - b.HasIndex(new[] { "Utilisateur", "TitreNormalise", "AuteurNormalise" }, "IX_LivresSouhaites_Utilisateur_Oeuvre") - .IsUnique(); - - b.ToTable("LivresSouhaites"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.NumeroRevue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("DateParution") - .HasColumnType("TEXT"); - - b.Property("Note") - .HasColumnType("TEXT"); - - b.Property("Numero") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NumeroNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("RevueId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RevueId", "NumeroNormalise") - .IsUnique(); - - b.ToTable("NumerosRevue"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatePret") - .HasColumnType("TEXT"); - - b.Property("DateRetour") - .HasColumnType("TEXT"); - - b.Property("Emprunteur") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId_EnCours") - .IsUnique() - .HasFilter("\"DateRetour\" IS NULL"); - - b.ToTable("Prets"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.RapprochementRefuse", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AuteurAId") - .HasColumnType("INTEGER"); - - b.Property("AuteurBId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("AuteurAId", "AuteurBId") - .IsUnique(); - - b.ToTable("RapprochementsRefuses"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Revue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Issn") - .HasColumnType("TEXT"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("TitreNormalise") - .IsUnique(); - - b.HasIndex(new[] { "Issn" }, "IX_Revues_Issn") - .IsUnique() - .HasFilter("\"Issn\" IS NOT NULL"); - - b.ToTable("Revues"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("SerieParenteId") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("SerieParenteId"); - - b.HasIndex("TitreNormalise") - .IsUnique(); - - b.ToTable("Series"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DateMaj") - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("Statut") - .HasColumnType("INTEGER"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Utilisateur"); - - b.HasIndex("LivreId", "Utilisateur") - .IsUnique(); - - b.ToTable("StatutsLecture"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.ElementSerie", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany() - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("MaBibli.Shared.Entites.Serie", "Serie") - .WithMany("Elements") - .HasForeignKey("SerieId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - - b.Navigation("Serie"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.HasOne("MaBibli.Shared.Entites.Auteur", "Auteur") - .WithMany("Livres") - .HasForeignKey("AuteurId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Auteurs") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Auteur"); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.NumeroRevue", b => - { - b.HasOne("MaBibli.Shared.Entites.Revue", "Revue") - .WithMany("Numeros") - .HasForeignKey("RevueId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Revue"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Prets") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.HasOne("MaBibli.Shared.Entites.Serie", "SerieParente") - .WithMany("SousSeries") - .HasForeignKey("SerieParenteId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("SerieParente"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Statuts") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Navigation("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Navigation("Auteurs"); - - b.Navigation("Prets"); - - b.Navigation("Statuts"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Revue", b => - { - b.Navigation("Numeros"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.Navigation("Elements"); - - b.Navigation("SousSeries"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260819203118_RolesDesAuteurs.cs b/MaBibli.Api/Data/Migrations/20260819203118_RolesDesAuteurs.cs deleted file mode 100644 index bb6711f..0000000 --- a/MaBibli.Api/Data/Migrations/20260819203118_RolesDesAuteurs.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - /// - public partial class RolesDesAuteurs : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Role", - table: "LivreAuteurs", - type: "INTEGER", - nullable: false, - defaultValue: 0); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Role", - table: "LivreAuteurs"); - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260820113543_MasquageBibliographie.Designer.cs b/MaBibli.Api/Data/Migrations/20260820113543_MasquageBibliographie.Designer.cs deleted file mode 100644 index cc45834..0000000 --- a/MaBibli.Api/Data/Migrations/20260820113543_MasquageBibliographie.Designer.cs +++ /dev/null @@ -1,528 +0,0 @@ -// -using System; -using MaBibli.Api.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - [DbContext(typeof(MaBibliDbContext))] - [Migration("20260820113543_MasquageBibliographie")] - partial class MasquageBibliographie - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "10.0.11"); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CleRegroupement") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Nom") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NomNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CleRegroupement") - .IsUnique(); - - b.HasIndex("NomNormalise"); - - b.ToTable("Auteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.BibliographieMasquee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AuteurId") - .HasColumnType("INTEGER"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Utilisateur", "AuteurId"); - - b.HasIndex(new[] { "AuteurId", "Utilisateur", "TitreNormalise" }, "IX_BibliographiesMasquees_Auteur_Utilisateur_Titre") - .IsUnique(); - - b.ToTable("BibliographiesMasquees"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.ElementSerie", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("SerieId") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("LivreId"); - - b.HasIndex(new[] { "SerieId" }, "IX_ElementsSerie_SerieId"); - - b.HasIndex(new[] { "SerieId", "LivreId" }, "IX_ElementsSerie_SerieId_LivreId") - .IsUnique() - .HasFilter("\"LivreId\" IS NOT NULL"); - - b.ToTable("ElementsSerie"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Format") - .HasColumnType("INTEGER"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TypeDocument") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Isbn"); - - b.HasIndex("TitreNormalise"); - - b.ToTable("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("AuteurId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("Role") - .HasColumnType("INTEGER"); - - b.HasKey("LivreId", "AuteurId"); - - b.HasIndex("AuteurId"); - - b.ToTable("LivreAuteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreSouhaite", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Annee") - .HasColumnType("TEXT"); - - b.Property("Auteur") - .HasColumnType("TEXT"); - - b.Property("AuteurNormalise") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasDefaultValue(""); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Note") - .HasColumnType("TEXT"); - - b.Property("Rang") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "Utilisateur" }, "IX_LivresSouhaites_Utilisateur"); - - b.HasIndex(new[] { "Utilisateur", "TitreNormalise", "AuteurNormalise" }, "IX_LivresSouhaites_Utilisateur_Oeuvre") - .IsUnique(); - - b.ToTable("LivresSouhaites"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.NumeroRevue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("DateParution") - .HasColumnType("TEXT"); - - b.Property("Note") - .HasColumnType("TEXT"); - - b.Property("Numero") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NumeroNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("RevueId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RevueId", "NumeroNormalise") - .IsUnique(); - - b.ToTable("NumerosRevue"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatePret") - .HasColumnType("TEXT"); - - b.Property("DateRetour") - .HasColumnType("TEXT"); - - b.Property("Emprunteur") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId_EnCours") - .IsUnique() - .HasFilter("\"DateRetour\" IS NULL"); - - b.ToTable("Prets"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.RapprochementRefuse", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AuteurAId") - .HasColumnType("INTEGER"); - - b.Property("AuteurBId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("AuteurAId", "AuteurBId") - .IsUnique(); - - b.ToTable("RapprochementsRefuses"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Revue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Issn") - .HasColumnType("TEXT"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("TitreNormalise") - .IsUnique(); - - b.HasIndex(new[] { "Issn" }, "IX_Revues_Issn") - .IsUnique() - .HasFilter("\"Issn\" IS NOT NULL"); - - b.ToTable("Revues"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("SerieParenteId") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("SerieParenteId"); - - b.HasIndex("TitreNormalise") - .IsUnique(); - - b.ToTable("Series"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DateMaj") - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("Statut") - .HasColumnType("INTEGER"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Utilisateur"); - - b.HasIndex("LivreId", "Utilisateur") - .IsUnique(); - - b.ToTable("StatutsLecture"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.ElementSerie", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany() - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("MaBibli.Shared.Entites.Serie", "Serie") - .WithMany("Elements") - .HasForeignKey("SerieId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - - b.Navigation("Serie"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.HasOne("MaBibli.Shared.Entites.Auteur", "Auteur") - .WithMany("Livres") - .HasForeignKey("AuteurId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Auteurs") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Auteur"); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.NumeroRevue", b => - { - b.HasOne("MaBibli.Shared.Entites.Revue", "Revue") - .WithMany("Numeros") - .HasForeignKey("RevueId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Revue"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Prets") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.HasOne("MaBibli.Shared.Entites.Serie", "SerieParente") - .WithMany("SousSeries") - .HasForeignKey("SerieParenteId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("SerieParente"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Statuts") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Navigation("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Navigation("Auteurs"); - - b.Navigation("Prets"); - - b.Navigation("Statuts"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Revue", b => - { - b.Navigation("Numeros"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.Navigation("Elements"); - - b.Navigation("SousSeries"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260820113543_MasquageBibliographie.cs b/MaBibli.Api/Data/Migrations/20260820113543_MasquageBibliographie.cs deleted file mode 100644 index c72448e..0000000 --- a/MaBibli.Api/Data/Migrations/20260820113543_MasquageBibliographie.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - /// - public partial class MasquageBibliographie : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "BibliographiesMasquees", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - AuteurId = table.Column(type: "INTEGER", nullable: false), - Utilisateur = table.Column(type: "TEXT", nullable: false), - TitreNormalise = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_BibliographiesMasquees", x => x.Id); - }); - - migrationBuilder.CreateIndex( - name: "IX_BibliographiesMasquees_Auteur_Utilisateur_Titre", - table: "BibliographiesMasquees", - columns: new[] { "AuteurId", "Utilisateur", "TitreNormalise" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_BibliographiesMasquees_Utilisateur_AuteurId", - table: "BibliographiesMasquees", - columns: new[] { "Utilisateur", "AuteurId" }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "BibliographiesMasquees"); - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260820115411_NoticeBibliographique.Designer.cs b/MaBibli.Api/Data/Migrations/20260820115411_NoticeBibliographique.Designer.cs deleted file mode 100644 index bad7692..0000000 --- a/MaBibli.Api/Data/Migrations/20260820115411_NoticeBibliographique.Designer.cs +++ /dev/null @@ -1,532 +0,0 @@ -// -using System; -using MaBibli.Api.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - [DbContext(typeof(MaBibliDbContext))] - [Migration("20260820115411_NoticeBibliographique")] - partial class NoticeBibliographique - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "10.0.11"); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CleRegroupement") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Nom") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NomNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CleRegroupement") - .IsUnique(); - - b.HasIndex("NomNormalise"); - - b.ToTable("Auteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.BibliographieMasquee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AuteurId") - .HasColumnType("INTEGER"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Utilisateur", "AuteurId"); - - b.HasIndex(new[] { "AuteurId", "Utilisateur", "TitreNormalise" }, "IX_BibliographiesMasquees_Auteur_Utilisateur_Titre") - .IsUnique(); - - b.ToTable("BibliographiesMasquees"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.ElementSerie", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("SerieId") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("LivreId"); - - b.HasIndex(new[] { "SerieId" }, "IX_ElementsSerie_SerieId"); - - b.HasIndex(new[] { "SerieId", "LivreId" }, "IX_ElementsSerie_SerieId_LivreId") - .IsUnique() - .HasFilter("\"LivreId\" IS NOT NULL"); - - b.ToTable("ElementsSerie"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Format") - .HasColumnType("INTEGER"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TypeDocument") - .HasColumnType("INTEGER"); - - b.Property("UrlNotice") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Isbn"); - - b.HasIndex("TitreNormalise"); - - b.ToTable("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("AuteurId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("Role") - .HasColumnType("INTEGER"); - - b.HasKey("LivreId", "AuteurId"); - - b.HasIndex("AuteurId"); - - b.ToTable("LivreAuteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreSouhaite", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Annee") - .HasColumnType("TEXT"); - - b.Property("Auteur") - .HasColumnType("TEXT"); - - b.Property("AuteurNormalise") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasDefaultValue(""); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Note") - .HasColumnType("TEXT"); - - b.Property("Rang") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "Utilisateur" }, "IX_LivresSouhaites_Utilisateur"); - - b.HasIndex(new[] { "Utilisateur", "TitreNormalise", "AuteurNormalise" }, "IX_LivresSouhaites_Utilisateur_Oeuvre") - .IsUnique(); - - b.ToTable("LivresSouhaites"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.NumeroRevue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("DateParution") - .HasColumnType("TEXT"); - - b.Property("Note") - .HasColumnType("TEXT"); - - b.Property("Numero") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NumeroNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("RevueId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RevueId", "NumeroNormalise") - .IsUnique(); - - b.ToTable("NumerosRevue"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatePret") - .HasColumnType("TEXT"); - - b.Property("DateRetour") - .HasColumnType("TEXT"); - - b.Property("Emprunteur") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId_EnCours") - .IsUnique() - .HasFilter("\"DateRetour\" IS NULL"); - - b.ToTable("Prets"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.RapprochementRefuse", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AuteurAId") - .HasColumnType("INTEGER"); - - b.Property("AuteurBId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("AuteurAId", "AuteurBId") - .IsUnique(); - - b.ToTable("RapprochementsRefuses"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Revue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Issn") - .HasColumnType("TEXT"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("TitreNormalise") - .IsUnique(); - - b.HasIndex(new[] { "Issn" }, "IX_Revues_Issn") - .IsUnique() - .HasFilter("\"Issn\" IS NOT NULL"); - - b.ToTable("Revues"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("SerieParenteId") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("SerieParenteId"); - - b.HasIndex("TitreNormalise") - .IsUnique(); - - b.ToTable("Series"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DateMaj") - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("Statut") - .HasColumnType("INTEGER"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Utilisateur"); - - b.HasIndex("LivreId", "Utilisateur") - .IsUnique(); - - b.ToTable("StatutsLecture"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.ElementSerie", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany() - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("MaBibli.Shared.Entites.Serie", "Serie") - .WithMany("Elements") - .HasForeignKey("SerieId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - - b.Navigation("Serie"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.HasOne("MaBibli.Shared.Entites.Auteur", "Auteur") - .WithMany("Livres") - .HasForeignKey("AuteurId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Auteurs") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Auteur"); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.NumeroRevue", b => - { - b.HasOne("MaBibli.Shared.Entites.Revue", "Revue") - .WithMany("Numeros") - .HasForeignKey("RevueId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Revue"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Prets") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.HasOne("MaBibli.Shared.Entites.Serie", "SerieParente") - .WithMany("SousSeries") - .HasForeignKey("SerieParenteId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("SerieParente"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Statuts") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Navigation("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Navigation("Auteurs"); - - b.Navigation("Prets"); - - b.Navigation("Statuts"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Revue", b => - { - b.Navigation("Numeros"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.Navigation("Elements"); - - b.Navigation("SousSeries"); - }); -#pragma warning restore 612, 618 - } - } -} - diff --git a/MaBibli.Api/Data/Migrations/20260820115411_NoticeBibliographique.cs b/MaBibli.Api/Data/Migrations/20260820115411_NoticeBibliographique.cs deleted file mode 100644 index b173b2f..0000000 --- a/MaBibli.Api/Data/Migrations/20260820115411_NoticeBibliographique.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - /// - public partial class NoticeBibliographique : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "UrlNotice", - table: "Livres", - type: "TEXT", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "UrlNotice", - table: "Livres"); - } - } -} - diff --git a/MaBibli.Api/Data/Migrations/20260820123516_ThemesEtEtiquettes.Designer.cs b/MaBibli.Api/Data/Migrations/20260820123516_ThemesEtEtiquettes.Designer.cs deleted file mode 100644 index 1c324e1..0000000 --- a/MaBibli.Api/Data/Migrations/20260820123516_ThemesEtEtiquettes.Designer.cs +++ /dev/null @@ -1,594 +0,0 @@ -// -using System; -using MaBibli.Api.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - [DbContext(typeof(MaBibliDbContext))] - [Migration("20260820123516_ThemesEtEtiquettes")] - partial class ThemesEtEtiquettes - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "10.0.11"); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CleRegroupement") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Nom") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NomNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CleRegroupement") - .IsUnique(); - - b.HasIndex("NomNormalise"); - - b.ToTable("Auteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.BibliographieMasquee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AuteurId") - .HasColumnType("INTEGER"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Utilisateur", "AuteurId"); - - b.HasIndex(new[] { "AuteurId", "Utilisateur", "TitreNormalise" }, "IX_BibliographiesMasquees_Auteur_Utilisateur_Titre") - .IsUnique(); - - b.ToTable("BibliographiesMasquees"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.ElementSerie", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("SerieId") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("LivreId"); - - b.HasIndex(new[] { "SerieId" }, "IX_ElementsSerie_SerieId"); - - b.HasIndex(new[] { "SerieId", "LivreId" }, "IX_ElementsSerie_SerieId_LivreId") - .IsUnique() - .HasFilter("\"LivreId\" IS NOT NULL"); - - b.ToTable("ElementsSerie"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Format") - .HasColumnType("INTEGER"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TypeDocument") - .HasColumnType("INTEGER"); - - b.Property("UrlNotice") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Isbn"); - - b.HasIndex("TitreNormalise"); - - b.ToTable("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("AuteurId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("Role") - .HasColumnType("INTEGER"); - - b.HasKey("LivreId", "AuteurId"); - - b.HasIndex("AuteurId"); - - b.ToTable("LivreAuteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreSouhaite", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Annee") - .HasColumnType("TEXT"); - - b.Property("Auteur") - .HasColumnType("TEXT"); - - b.Property("AuteurNormalise") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasDefaultValue(""); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Note") - .HasColumnType("TEXT"); - - b.Property("Rang") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "Utilisateur" }, "IX_LivresSouhaites_Utilisateur"); - - b.HasIndex(new[] { "Utilisateur", "TitreNormalise", "AuteurNormalise" }, "IX_LivresSouhaites_Utilisateur_Oeuvre") - .IsUnique(); - - b.ToTable("LivresSouhaites"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreTheme", b => - { - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("ThemeId") - .HasColumnType("INTEGER"); - - b.HasKey("LivreId", "ThemeId"); - - b.HasIndex("ThemeId"); - - b.ToTable("LivreThemes"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.NumeroRevue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("DateParution") - .HasColumnType("TEXT"); - - b.Property("Note") - .HasColumnType("TEXT"); - - b.Property("Numero") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NumeroNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("RevueId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RevueId", "NumeroNormalise") - .IsUnique(); - - b.ToTable("NumerosRevue"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatePret") - .HasColumnType("TEXT"); - - b.Property("DateRetour") - .HasColumnType("TEXT"); - - b.Property("Emprunteur") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId_EnCours") - .IsUnique() - .HasFilter("\"DateRetour\" IS NULL"); - - b.ToTable("Prets"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.RapprochementRefuse", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AuteurAId") - .HasColumnType("INTEGER"); - - b.Property("AuteurBId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("AuteurAId", "AuteurBId") - .IsUnique(); - - b.ToTable("RapprochementsRefuses"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Revue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Issn") - .HasColumnType("TEXT"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("TitreNormalise") - .IsUnique(); - - b.HasIndex(new[] { "Issn" }, "IX_Revues_Issn") - .IsUnique() - .HasFilter("\"Issn\" IS NOT NULL"); - - b.ToTable("Revues"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("SerieParenteId") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("SerieParenteId"); - - b.HasIndex("TitreNormalise") - .IsUnique(); - - b.ToTable("Series"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DateMaj") - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("Statut") - .HasColumnType("INTEGER"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Utilisateur"); - - b.HasIndex("LivreId", "Utilisateur") - .IsUnique(); - - b.ToTable("StatutsLecture"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Theme", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Nom") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NomNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NomNormalise") - .IsUnique(); - - b.ToTable("Themes"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.ElementSerie", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany() - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("MaBibli.Shared.Entites.Serie", "Serie") - .WithMany("Elements") - .HasForeignKey("SerieId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - - b.Navigation("Serie"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.HasOne("MaBibli.Shared.Entites.Auteur", "Auteur") - .WithMany("Livres") - .HasForeignKey("AuteurId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Auteurs") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Auteur"); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreTheme", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Themes") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MaBibli.Shared.Entites.Theme", "Theme") - .WithMany("Livres") - .HasForeignKey("ThemeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Livre"); - - b.Navigation("Theme"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.NumeroRevue", b => - { - b.HasOne("MaBibli.Shared.Entites.Revue", "Revue") - .WithMany("Numeros") - .HasForeignKey("RevueId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Revue"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Prets") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.HasOne("MaBibli.Shared.Entites.Serie", "SerieParente") - .WithMany("SousSeries") - .HasForeignKey("SerieParenteId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("SerieParente"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Statuts") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Navigation("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Navigation("Auteurs"); - - b.Navigation("Prets"); - - b.Navigation("Statuts"); - - b.Navigation("Themes"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Revue", b => - { - b.Navigation("Numeros"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.Navigation("Elements"); - - b.Navigation("SousSeries"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Theme", b => - { - b.Navigation("Livres"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260820123516_ThemesEtEtiquettes.cs b/MaBibli.Api/Data/Migrations/20260820123516_ThemesEtEtiquettes.cs deleted file mode 100644 index c5a4e37..0000000 --- a/MaBibli.Api/Data/Migrations/20260820123516_ThemesEtEtiquettes.cs +++ /dev/null @@ -1,73 +0,0 @@ -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"); - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260821084601_ImagesEtUnesDesNumeros.Designer.cs b/MaBibli.Api/Data/Migrations/20260821084601_ImagesEtUnesDesNumeros.Designer.cs deleted file mode 100644 index feed027..0000000 --- a/MaBibli.Api/Data/Migrations/20260821084601_ImagesEtUnesDesNumeros.Designer.cs +++ /dev/null @@ -1,641 +0,0 @@ -// -using System; -using MaBibli.Api.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - [DbContext(typeof(MaBibliDbContext))] - [Migration("20260821084601_ImagesEtUnesDesNumeros")] - partial class ImagesEtUnesDesNumeros - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "10.0.11"); - - modelBuilder.Entity("MaBibli.Shared.Entites.ArticleUne", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("NumeroRevueId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NumeroRevueId", "TitreNormalise") - .IsUnique(); - - b.ToTable("ArticlesUne"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CleRegroupement") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Nom") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NomNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CleRegroupement") - .IsUnique(); - - b.HasIndex("NomNormalise"); - - b.ToTable("Auteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.BibliographieMasquee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AuteurId") - .HasColumnType("INTEGER"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Utilisateur", "AuteurId"); - - b.HasIndex(new[] { "AuteurId", "Utilisateur", "TitreNormalise" }, "IX_BibliographiesMasquees_Auteur_Utilisateur_Titre") - .IsUnique(); - - b.ToTable("BibliographiesMasquees"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.ElementSerie", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("SerieId") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("LivreId"); - - b.HasIndex(new[] { "SerieId" }, "IX_ElementsSerie_SerieId"); - - b.HasIndex(new[] { "SerieId", "LivreId" }, "IX_ElementsSerie_SerieId_LivreId") - .IsUnique() - .HasFilter("\"LivreId\" IS NOT NULL"); - - b.ToTable("ElementsSerie"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Format") - .HasColumnType("INTEGER"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TypeDocument") - .HasColumnType("INTEGER"); - - b.Property("UrlNotice") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Isbn"); - - b.HasIndex("TitreNormalise"); - - b.ToTable("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("AuteurId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("Role") - .HasColumnType("INTEGER"); - - b.HasKey("LivreId", "AuteurId"); - - b.HasIndex("AuteurId"); - - b.ToTable("LivreAuteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreSouhaite", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Annee") - .HasColumnType("TEXT"); - - b.Property("Auteur") - .HasColumnType("TEXT"); - - b.Property("AuteurNormalise") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasDefaultValue(""); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Note") - .HasColumnType("TEXT"); - - b.Property("Rang") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "Utilisateur" }, "IX_LivresSouhaites_Utilisateur"); - - b.HasIndex(new[] { "Utilisateur", "TitreNormalise", "AuteurNormalise" }, "IX_LivresSouhaites_Utilisateur_Oeuvre") - .IsUnique(); - - b.ToTable("LivresSouhaites"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreTheme", b => - { - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("ThemeId") - .HasColumnType("INTEGER"); - - b.HasKey("LivreId", "ThemeId"); - - b.HasIndex("ThemeId"); - - b.ToTable("LivreThemes"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.NumeroRevue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("DateParution") - .HasColumnType("TEXT"); - - b.Property("Note") - .HasColumnType("TEXT"); - - b.Property("Numero") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NumeroNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("RevueId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RevueId", "NumeroNormalise") - .IsUnique(); - - b.ToTable("NumerosRevue"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatePret") - .HasColumnType("TEXT"); - - b.Property("DateRetour") - .HasColumnType("TEXT"); - - b.Property("Emprunteur") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId_EnCours") - .IsUnique() - .HasFilter("\"DateRetour\" IS NULL"); - - b.ToTable("Prets"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.RapprochementRefuse", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AuteurAId") - .HasColumnType("INTEGER"); - - b.Property("AuteurBId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("AuteurAId", "AuteurBId") - .IsUnique(); - - b.ToTable("RapprochementsRefuses"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Revue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Issn") - .HasColumnType("TEXT"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("TitreNormalise") - .IsUnique(); - - b.HasIndex(new[] { "Issn" }, "IX_Revues_Issn") - .IsUnique() - .HasFilter("\"Issn\" IS NOT NULL"); - - b.ToTable("Revues"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("SerieParenteId") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("SerieParenteId"); - - b.HasIndex("TitreNormalise") - .IsUnique(); - - b.ToTable("Series"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DateMaj") - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("Statut") - .HasColumnType("INTEGER"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Utilisateur"); - - b.HasIndex("LivreId", "Utilisateur") - .IsUnique(); - - b.ToTable("StatutsLecture"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Theme", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Nom") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NomNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NomNormalise") - .IsUnique(); - - b.ToTable("Themes"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.ArticleUne", b => - { - b.HasOne("MaBibli.Shared.Entites.NumeroRevue", "NumeroRevue") - .WithMany("Articles") - .HasForeignKey("NumeroRevueId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NumeroRevue"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.ElementSerie", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany() - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("MaBibli.Shared.Entites.Serie", "Serie") - .WithMany("Elements") - .HasForeignKey("SerieId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - - b.Navigation("Serie"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.HasOne("MaBibli.Shared.Entites.Auteur", "Auteur") - .WithMany("Livres") - .HasForeignKey("AuteurId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Auteurs") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Auteur"); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreTheme", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Themes") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MaBibli.Shared.Entites.Theme", "Theme") - .WithMany("Livres") - .HasForeignKey("ThemeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Livre"); - - b.Navigation("Theme"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.NumeroRevue", b => - { - b.HasOne("MaBibli.Shared.Entites.Revue", "Revue") - .WithMany("Numeros") - .HasForeignKey("RevueId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Revue"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Prets") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.HasOne("MaBibli.Shared.Entites.Serie", "SerieParente") - .WithMany("SousSeries") - .HasForeignKey("SerieParenteId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("SerieParente"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Statuts") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Navigation("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Navigation("Auteurs"); - - b.Navigation("Prets"); - - b.Navigation("Statuts"); - - b.Navigation("Themes"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.NumeroRevue", b => - { - b.Navigation("Articles"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Revue", b => - { - b.Navigation("Numeros"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.Navigation("Elements"); - - b.Navigation("SousSeries"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Theme", b => - { - b.Navigation("Livres"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260821084601_ImagesEtUnesDesNumeros.cs b/MaBibli.Api/Data/Migrations/20260821084601_ImagesEtUnesDesNumeros.cs deleted file mode 100644 index 2b732cb..0000000 --- a/MaBibli.Api/Data/Migrations/20260821084601_ImagesEtUnesDesNumeros.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - /// - public partial class ImagesEtUnesDesNumeros : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "CoverUrl", - table: "NumerosRevue", - type: "TEXT", - nullable: true); - - migrationBuilder.CreateTable( - name: "ArticlesUne", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - NumeroRevueId = table.Column(type: "INTEGER", nullable: false), - Titre = table.Column(type: "TEXT", nullable: false), - TitreNormalise = table.Column(type: "TEXT", nullable: false), - Position = table.Column(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); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ArticlesUne"); - - migrationBuilder.DropColumn( - name: "CoverUrl", - table: "NumerosRevue"); - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260821114427_NombreDePages.Designer.cs b/MaBibli.Api/Data/Migrations/20260821114427_NombreDePages.Designer.cs deleted file mode 100644 index 823225e..0000000 --- a/MaBibli.Api/Data/Migrations/20260821114427_NombreDePages.Designer.cs +++ /dev/null @@ -1,644 +0,0 @@ -// -using System; -using MaBibli.Api.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - [DbContext(typeof(MaBibliDbContext))] - [Migration("20260821114427_NombreDePages")] - partial class NombreDePages - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "10.0.11"); - - modelBuilder.Entity("MaBibli.Shared.Entites.ArticleUne", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("NumeroRevueId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NumeroRevueId", "TitreNormalise") - .IsUnique(); - - b.ToTable("ArticlesUne"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CleRegroupement") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Nom") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NomNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CleRegroupement") - .IsUnique(); - - b.HasIndex("NomNormalise"); - - b.ToTable("Auteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.BibliographieMasquee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AuteurId") - .HasColumnType("INTEGER"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Utilisateur", "AuteurId"); - - b.HasIndex(new[] { "AuteurId", "Utilisateur", "TitreNormalise" }, "IX_BibliographiesMasquees_Auteur_Utilisateur_Titre") - .IsUnique(); - - b.ToTable("BibliographiesMasquees"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.ElementSerie", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("SerieId") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("LivreId"); - - b.HasIndex(new[] { "SerieId" }, "IX_ElementsSerie_SerieId"); - - b.HasIndex(new[] { "SerieId", "LivreId" }, "IX_ElementsSerie_SerieId_LivreId") - .IsUnique() - .HasFilter("\"LivreId\" IS NOT NULL"); - - b.ToTable("ElementsSerie"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Format") - .HasColumnType("INTEGER"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("NombrePages") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TypeDocument") - .HasColumnType("INTEGER"); - - b.Property("UrlNotice") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Isbn"); - - b.HasIndex("TitreNormalise"); - - b.ToTable("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("AuteurId") - .HasColumnType("INTEGER"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("Role") - .HasColumnType("INTEGER"); - - b.HasKey("LivreId", "AuteurId"); - - b.HasIndex("AuteurId"); - - b.ToTable("LivreAuteurs"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreSouhaite", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Annee") - .HasColumnType("TEXT"); - - b.Property("Auteur") - .HasColumnType("TEXT"); - - b.Property("AuteurNormalise") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasDefaultValue(""); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Isbn") - .HasColumnType("TEXT"); - - b.Property("Note") - .HasColumnType("TEXT"); - - b.Property("Rang") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "Utilisateur" }, "IX_LivresSouhaites_Utilisateur"); - - b.HasIndex(new[] { "Utilisateur", "TitreNormalise", "AuteurNormalise" }, "IX_LivresSouhaites_Utilisateur_Oeuvre") - .IsUnique(); - - b.ToTable("LivresSouhaites"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreTheme", b => - { - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("ThemeId") - .HasColumnType("INTEGER"); - - b.HasKey("LivreId", "ThemeId"); - - b.HasIndex("ThemeId"); - - b.ToTable("LivreThemes"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.NumeroRevue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CoverUrl") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("DateParution") - .HasColumnType("TEXT"); - - b.Property("Note") - .HasColumnType("TEXT"); - - b.Property("Numero") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NumeroNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("RevueId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RevueId", "NumeroNormalise") - .IsUnique(); - - b.ToTable("NumerosRevue"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatePret") - .HasColumnType("TEXT"); - - b.Property("DateRetour") - .HasColumnType("TEXT"); - - b.Property("Emprunteur") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId"); - - b.HasIndex(new[] { "LivreId" }, "IX_Prets_LivreId_EnCours") - .IsUnique() - .HasFilter("\"DateRetour\" IS NULL"); - - b.ToTable("Prets"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.RapprochementRefuse", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AuteurAId") - .HasColumnType("INTEGER"); - - b.Property("AuteurBId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("AuteurAId", "AuteurBId") - .IsUnique(); - - b.ToTable("RapprochementsRefuses"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Revue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Editeur") - .HasColumnType("TEXT"); - - b.Property("Issn") - .HasColumnType("TEXT"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("TitreNormalise") - .IsUnique(); - - b.HasIndex(new[] { "Issn" }, "IX_Revues_Issn") - .IsUnique() - .HasFilter("\"Issn\" IS NOT NULL"); - - b.ToTable("Revues"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AjoutePar") - .HasColumnType("TEXT"); - - b.Property("DateAjout") - .HasColumnType("TEXT"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("SerieParenteId") - .HasColumnType("INTEGER"); - - b.Property("Titre") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TitreNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("SerieParenteId"); - - b.HasIndex("TitreNormalise") - .IsUnique(); - - b.ToTable("Series"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DateMaj") - .HasColumnType("TEXT"); - - b.Property("LivreId") - .HasColumnType("INTEGER"); - - b.Property("Statut") - .HasColumnType("INTEGER"); - - b.Property("Utilisateur") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Utilisateur"); - - b.HasIndex("LivreId", "Utilisateur") - .IsUnique(); - - b.ToTable("StatutsLecture"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Theme", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Nom") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NomNormalise") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NomNormalise") - .IsUnique(); - - b.ToTable("Themes"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.ArticleUne", b => - { - b.HasOne("MaBibli.Shared.Entites.NumeroRevue", "NumeroRevue") - .WithMany("Articles") - .HasForeignKey("NumeroRevueId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NumeroRevue"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.ElementSerie", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany() - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("MaBibli.Shared.Entites.Serie", "Serie") - .WithMany("Elements") - .HasForeignKey("SerieId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - - b.Navigation("Serie"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreAuteur", b => - { - b.HasOne("MaBibli.Shared.Entites.Auteur", "Auteur") - .WithMany("Livres") - .HasForeignKey("AuteurId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Auteurs") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Auteur"); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.LivreTheme", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Themes") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("MaBibli.Shared.Entites.Theme", "Theme") - .WithMany("Livres") - .HasForeignKey("ThemeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Livre"); - - b.Navigation("Theme"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.NumeroRevue", b => - { - b.HasOne("MaBibli.Shared.Entites.Revue", "Revue") - .WithMany("Numeros") - .HasForeignKey("RevueId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Revue"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Pret", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Prets") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.HasOne("MaBibli.Shared.Entites.Serie", "SerieParente") - .WithMany("SousSeries") - .HasForeignKey("SerieParenteId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("SerieParente"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.StatutLecture", b => - { - b.HasOne("MaBibli.Shared.Entites.Livre", "Livre") - .WithMany("Statuts") - .HasForeignKey("LivreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Livre"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Auteur", b => - { - b.Navigation("Livres"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Livre", b => - { - b.Navigation("Auteurs"); - - b.Navigation("Prets"); - - b.Navigation("Statuts"); - - b.Navigation("Themes"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.NumeroRevue", b => - { - b.Navigation("Articles"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Revue", b => - { - b.Navigation("Numeros"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Serie", b => - { - b.Navigation("Elements"); - - b.Navigation("SousSeries"); - }); - - modelBuilder.Entity("MaBibli.Shared.Entites.Theme", b => - { - b.Navigation("Livres"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260821114427_NombreDePages.cs b/MaBibli.Api/Data/Migrations/20260821114427_NombreDePages.cs deleted file mode 100644 index 684414f..0000000 --- a/MaBibli.Api/Data/Migrations/20260821114427_NombreDePages.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - /// - /// Ajoute le nombre de pages, nullable, sans rien reprendre de l'existant. - /// - /// - /// ⚠️ Aucune valeur par défaut, et surtout pas 0 : aucun livre déjà catalogué ne - /// porte cette information, et un zéro écrit partout se lirait comme « ce livre n'a pas de - /// pages » au lieu de « on ne sait pas ». C'est la même raison qui a permis à - /// TypeDeDocument de se réduire à un AddColumn — un défaut qui ne prétend - /// rien n'a rien à reprendre, contrairement à RangDesEnvies. - /// - public partial class NombreDePages : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "NombrePages", - table: "Livres", - type: "INTEGER", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "NombrePages", - table: "Livres"); - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260821115007_EnviesDeRevues.cs b/MaBibli.Api/Data/Migrations/20260821115007_EnviesDeRevues.cs deleted file mode 100644 index 313a0ac..0000000 --- a/MaBibli.Api/Data/Migrations/20260821115007_EnviesDeRevues.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace MaBibli.Api.Data.Migrations -{ - /// - /// Crée la table sœur des envies : les revues et numéros souhaités. - /// - /// - /// Rien à reprendre de l'existant — la notion n'existait pas — donc une simple création de - /// table, contrairement à RangDesEnvies qui devait reconduire un ordre déjà affiché. - /// - /// ⚠️ NumeroNormalise est NOT NULL avec un défaut vide, et ce n'est pas une - /// coquetterie : SQLite tient deux NULL pour distincts, et l'unicité ci-dessous - /// laisserait alors ajouter autant de fois « Médor, sans numéro » qu'on voudrait. Même - /// piège que LivresSouhaites.AuteurNormalise. - /// - /// - public partial class EnviesDeRevues : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "RevuesSouhaitees", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Utilisateur = table.Column(type: "TEXT", nullable: false), - Titre = table.Column(type: "TEXT", nullable: false), - TitreNormalise = table.Column(type: "TEXT", nullable: false), - Numero = table.Column(type: "TEXT", nullable: true), - NumeroNormalise = table.Column(type: "TEXT", nullable: false, defaultValue: ""), - Issn = table.Column(type: "TEXT", nullable: true), - Note = table.Column(type: "TEXT", nullable: true), - DateAjout = table.Column(type: "TEXT", nullable: false), - Rang = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_RevuesSouhaitees", x => x.Id); - }); - - migrationBuilder.CreateIndex( - name: "IX_RevuesSouhaitees_Utilisateur", - table: "RevuesSouhaitees", - column: "Utilisateur"); - - migrationBuilder.CreateIndex( - name: "IX_RevuesSouhaitees_Utilisateur_Revue", - table: "RevuesSouhaitees", - columns: new[] { "Utilisateur", "TitreNormalise", "NumeroNormalise" }, - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "RevuesSouhaitees"); - } - } -} diff --git a/MaBibli.Api/Data/Migrations/20260821115007_EnviesDeRevues.Designer.cs b/MaBibli.Api/Data/Migrations/20260822104741_InitialCreate.Designer.cs similarity index 99% rename from MaBibli.Api/Data/Migrations/20260821115007_EnviesDeRevues.Designer.cs rename to MaBibli.Api/Data/Migrations/20260822104741_InitialCreate.Designer.cs index a729c70..6e8c43d 100644 --- a/MaBibli.Api/Data/Migrations/20260821115007_EnviesDeRevues.Designer.cs +++ b/MaBibli.Api/Data/Migrations/20260822104741_InitialCreate.Designer.cs @@ -11,8 +11,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace MaBibli.Api.Data.Migrations { [DbContext(typeof(MaBibliDbContext))] - [Migration("20260821115007_EnviesDeRevues")] - partial class EnviesDeRevues + [Migration("20260822104741_InitialCreate")] + partial class InitialCreate { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) diff --git a/MaBibli.Api/Data/Migrations/20260822104741_InitialCreate.cs b/MaBibli.Api/Data/Migrations/20260822104741_InitialCreate.cs new file mode 100644 index 0000000..0b103d7 --- /dev/null +++ b/MaBibli.Api/Data/Migrations/20260822104741_InitialCreate.cs @@ -0,0 +1,556 @@ +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: "Auteurs", + 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), + CleRegroupement = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Auteurs", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "BibliographiesMasquees", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + AuteurId = table.Column(type: "INTEGER", nullable: false), + Utilisateur = table.Column(type: "TEXT", nullable: false), + TitreNormalise = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_BibliographiesMasquees", x => x.Id); + }); + + 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), + TitreNormalise = table.Column(type: "TEXT", nullable: false), + Editeur = table.Column(type: "TEXT", nullable: true), + Format = table.Column(type: "INTEGER", nullable: false), + TypeDocument = table.Column(type: "INTEGER", nullable: false), + NombrePages = table.Column(type: "INTEGER", nullable: true), + CoverUrl = table.Column(type: "TEXT", nullable: true), + UrlNotice = 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: "LivresSouhaites", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Utilisateur = table.Column(type: "TEXT", nullable: false), + Titre = table.Column(type: "TEXT", nullable: false), + TitreNormalise = table.Column(type: "TEXT", nullable: false), + Auteur = table.Column(type: "TEXT", nullable: true), + AuteurNormalise = table.Column(type: "TEXT", nullable: false, defaultValue: ""), + Editeur = table.Column(type: "TEXT", nullable: true), + Annee = table.Column(type: "TEXT", nullable: true), + Isbn = table.Column(type: "TEXT", nullable: true), + CoverUrl = table.Column(type: "TEXT", nullable: true), + Note = table.Column(type: "TEXT", nullable: true), + DateAjout = table.Column(type: "TEXT", nullable: false), + Rang = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_LivresSouhaites", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "RapprochementsRefuses", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + AuteurAId = table.Column(type: "INTEGER", nullable: false), + AuteurBId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_RapprochementsRefuses", x => x.Id); + }); + + 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: "RevuesSouhaitees", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Utilisateur = table.Column(type: "TEXT", nullable: false), + Titre = table.Column(type: "TEXT", nullable: false), + TitreNormalise = table.Column(type: "TEXT", nullable: false), + Numero = table.Column(type: "TEXT", nullable: true), + NumeroNormalise = table.Column(type: "TEXT", nullable: false, defaultValue: ""), + Issn = table.Column(type: "TEXT", nullable: true), + Note = table.Column(type: "TEXT", nullable: true), + DateAjout = table.Column(type: "TEXT", nullable: false), + Rang = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_RevuesSouhaitees", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Series", + 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), + SerieParenteId = table.Column(type: "INTEGER", nullable: true), + Position = table.Column(type: "INTEGER", nullable: false), + DateAjout = table.Column(type: "TEXT", nullable: false), + AjoutePar = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Series", x => x.Id); + table.ForeignKey( + name: "FK_Series_Series_SerieParenteId", + column: x => x.SerieParenteId, + principalTable: "Series", + principalColumn: "Id", + onDelete: ReferentialAction.SetNull); + }); + + 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: "LivreAuteurs", + columns: table => new + { + LivreId = table.Column(type: "INTEGER", nullable: false), + AuteurId = table.Column(type: "INTEGER", nullable: false), + Position = table.Column(type: "INTEGER", nullable: false), + Role = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_LivreAuteurs", x => new { x.LivreId, x.AuteurId }); + table.ForeignKey( + name: "FK_LivreAuteurs_Auteurs_AuteurId", + column: x => x.AuteurId, + principalTable: "Auteurs", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_LivreAuteurs_Livres_LivreId", + column: x => x.LivreId, + principalTable: "Livres", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + 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.CreateTable( + name: "StatutsLecture", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + LivreId = table.Column(type: "INTEGER", nullable: false), + Utilisateur = table.Column(type: "TEXT", nullable: false), + Statut = table.Column(type: "INTEGER", nullable: false), + DateMaj = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_StatutsLecture", x => x.Id); + table.ForeignKey( + name: "FK_StatutsLecture_Livres_LivreId", + column: x => x.LivreId, + principalTable: "Livres", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + 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), + CoverUrl = 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.CreateTable( + name: "ElementsSerie", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + SerieId = table.Column(type: "INTEGER", nullable: false), + Position = table.Column(type: "INTEGER", nullable: false), + LivreId = table.Column(type: "INTEGER", nullable: true), + Titre = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ElementsSerie", x => x.Id); + table.ForeignKey( + name: "FK_ElementsSerie_Livres_LivreId", + column: x => x.LivreId, + principalTable: "Livres", + principalColumn: "Id", + onDelete: ReferentialAction.SetNull); + table.ForeignKey( + name: "FK_ElementsSerie_Series_SerieId", + column: x => x.SerieId, + principalTable: "Series", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + 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.CreateTable( + name: "ArticlesUne", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + NumeroRevueId = table.Column(type: "INTEGER", nullable: false), + Titre = table.Column(type: "TEXT", nullable: false), + TitreNormalise = table.Column(type: "TEXT", nullable: false), + Position = table.Column(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); + + migrationBuilder.CreateIndex( + name: "IX_Auteurs_CleRegroupement", + table: "Auteurs", + column: "CleRegroupement", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Auteurs_NomNormalise", + table: "Auteurs", + column: "NomNormalise"); + + migrationBuilder.CreateIndex( + name: "IX_BibliographiesMasquees_Auteur_Utilisateur_Titre", + table: "BibliographiesMasquees", + columns: new[] { "AuteurId", "Utilisateur", "TitreNormalise" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_BibliographiesMasquees_Utilisateur_AuteurId", + table: "BibliographiesMasquees", + columns: new[] { "Utilisateur", "AuteurId" }); + + migrationBuilder.CreateIndex( + name: "IX_ElementsSerie_LivreId", + table: "ElementsSerie", + column: "LivreId"); + + migrationBuilder.CreateIndex( + name: "IX_ElementsSerie_SerieId", + table: "ElementsSerie", + column: "SerieId"); + + migrationBuilder.CreateIndex( + name: "IX_ElementsSerie_SerieId_LivreId", + table: "ElementsSerie", + columns: new[] { "SerieId", "LivreId" }, + unique: true, + filter: "\"LivreId\" IS NOT NULL"); + + migrationBuilder.CreateIndex( + name: "IX_LivreAuteurs_AuteurId", + table: "LivreAuteurs", + column: "AuteurId"); + + migrationBuilder.CreateIndex( + name: "IX_Livres_Isbn", + table: "Livres", + column: "Isbn"); + + migrationBuilder.CreateIndex( + name: "IX_Livres_TitreNormalise", + table: "Livres", + column: "TitreNormalise"); + + migrationBuilder.CreateIndex( + name: "IX_LivresSouhaites_Utilisateur", + table: "LivresSouhaites", + column: "Utilisateur"); + + migrationBuilder.CreateIndex( + name: "IX_LivresSouhaites_Utilisateur_Oeuvre", + table: "LivresSouhaites", + columns: new[] { "Utilisateur", "TitreNormalise", "AuteurNormalise" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_LivreThemes_ThemeId", + table: "LivreThemes", + column: "ThemeId"); + + migrationBuilder.CreateIndex( + name: "IX_NumerosRevue_RevueId_NumeroNormalise", + table: "NumerosRevue", + columns: new[] { "RevueId", "NumeroNormalise" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Prets_LivreId", + table: "Prets", + column: "LivreId"); + + migrationBuilder.CreateIndex( + name: "IX_Prets_LivreId_EnCours", + table: "Prets", + column: "LivreId", + unique: true, + filter: "\"DateRetour\" IS NULL"); + + migrationBuilder.CreateIndex( + name: "IX_RapprochementsRefuses_AuteurAId_AuteurBId", + table: "RapprochementsRefuses", + columns: new[] { "AuteurAId", "AuteurBId" }, + 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); + + migrationBuilder.CreateIndex( + name: "IX_RevuesSouhaitees_Utilisateur", + table: "RevuesSouhaitees", + column: "Utilisateur"); + + migrationBuilder.CreateIndex( + name: "IX_RevuesSouhaitees_Utilisateur_Revue", + table: "RevuesSouhaitees", + columns: new[] { "Utilisateur", "TitreNormalise", "NumeroNormalise" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Series_SerieParenteId", + table: "Series", + column: "SerieParenteId"); + + migrationBuilder.CreateIndex( + name: "IX_Series_TitreNormalise", + table: "Series", + column: "TitreNormalise", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_StatutsLecture_LivreId_Utilisateur", + table: "StatutsLecture", + columns: new[] { "LivreId", "Utilisateur" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_StatutsLecture_Utilisateur", + table: "StatutsLecture", + column: "Utilisateur"); + + migrationBuilder.CreateIndex( + name: "IX_Themes_NomNormalise", + table: "Themes", + column: "NomNormalise", + unique: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ArticlesUne"); + + migrationBuilder.DropTable( + name: "BibliographiesMasquees"); + + migrationBuilder.DropTable( + name: "ElementsSerie"); + + migrationBuilder.DropTable( + name: "LivreAuteurs"); + + migrationBuilder.DropTable( + name: "LivresSouhaites"); + + migrationBuilder.DropTable( + name: "LivreThemes"); + + migrationBuilder.DropTable( + name: "Prets"); + + migrationBuilder.DropTable( + name: "RapprochementsRefuses"); + + migrationBuilder.DropTable( + name: "RevuesSouhaitees"); + + migrationBuilder.DropTable( + name: "StatutsLecture"); + + migrationBuilder.DropTable( + name: "NumerosRevue"); + + migrationBuilder.DropTable( + name: "Series"); + + migrationBuilder.DropTable( + name: "Auteurs"); + + migrationBuilder.DropTable( + name: "Themes"); + + migrationBuilder.DropTable( + name: "Livres"); + + migrationBuilder.DropTable( + name: "Revues"); + } + } +} diff --git a/MaBibli.Tests/MigrationRangDesEnviesTests.cs b/MaBibli.Tests/MigrationRangDesEnviesTests.cs deleted file mode 100644 index 5929c64..0000000 --- a/MaBibli.Tests/MigrationRangDesEnviesTests.cs +++ /dev/null @@ -1,111 +0,0 @@ -using MaBibli.Api.Data; -using Microsoft.Data.Sqlite; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.Extensions.DependencyInjection; - -namespace MaBibli.Tests; - -/// -/// La migration RangDesEnvies, appliquée pour de vrai à une base déjà peuplée. -/// -/// -/// Ce test ne double pas ServiceSouhaitsTests : celui-ci crée son schéma avec -/// EnsureCreated, qui ne joue aucune migration. Le remplissage de la colonne -/// Rang n'y passerait donc jamais, et une erreur dans son SQL ne se verrait qu'en -/// production — sur les listes d'envies réelles, qui se réordonneraient sous les yeux de leur -/// propriétaire. -/// -public class MigrationRangDesEnviesTests : IDisposable -{ - private const string AvantLeRang = "20260818052834_ListeDEnvies"; - - private readonly SqliteConnection _connexion; - private readonly MaBibliDbContext _db; - - public MigrationRangDesEnviesTests() - { - // Connexion maintenue ouverte : une base SQLite « :memory: » disparaît avec elle. - _connexion = new SqliteConnection("Data Source=:memory:"); - _connexion.Open(); - - _db = new MaBibliDbContext( - new DbContextOptionsBuilder().UseSqlite(_connexion).Options); - } - - private IMigrator Migrateur => _db.GetInfrastructure().GetRequiredService(); - - /// - /// Le cœur du test : la migration doit reconduire l'ordre affiché jusqu'ici — - /// auteurs renseignés d'abord, puis par auteur, puis par titre — et repartir de zéro pour - /// chaque utilisateur, le rang étant personnel comme le reste de la table. - /// - [Fact] - public async Task Reconduit_lancien_ordre_daffichage_utilisateur_par_utilisateur() - { - await Migrateur.MigrateAsync(AvantLeRang); - - // Insertion en SQL brut : à ce point du schéma, la colonne Rang n'existe pas encore, - // et l'entité C# la porte déjà. Passer par EF échouerait. - await ExecuterAsync(""" - INSERT INTO LivresSouhaites - (Id, Utilisateur, Titre, TitreNormalise, Auteur, AuteurNormalise, DateAjout) - VALUES - (1, 'mathieu', 'Germinal', 'germinal', 'Émile Zola', 'emile zola', '2026-01-01'), - (2, 'mathieu', 'Sans nom', 'sans nom', NULL, '', '2026-01-02'), - (3, 'mathieu', 'Au bonheur', 'au bonheur', 'Émile Zola', 'emile zola', '2026-01-03'), - (4, 'mathieu', 'Les fourmis','les fourmis','Bernard Werber', 'bernard werber', '2026-01-04'), - (5, 'camille', 'Sa liste', 'sa liste', 'Bernard Werber', 'bernard werber', '2026-01-05'), - (6, 'camille', 'Sans nom', 'sans nom', NULL, '', '2026-01-06'); - """); - - await Migrateur.MigrateAsync(); - - // Werber avant Zola, « Au bonheur » avant « Germinal », et l'envie sans auteur en - // dernier : exactement ce que la liste montrait avant la colonne. - Assert.Equal( - [(0, "Les fourmis"), (1, "Au bonheur"), (2, "Germinal"), (3, "Sans nom")], - await RangsAsync("mathieu")); - - // ⚠️ La numérotation de Camille repart de zéro : le rang n'a de sens qu'à l'intérieur - // d'une liste. Continuer celle de Mathieu ferait dépendre l'ordre de l'un de l'autre. - Assert.Equal([(0, "Sa liste"), (1, "Sans nom")], await RangsAsync("camille")); - } - - /// Une base sans aucune envie doit traverser la migration sans broncher. - [Fact] - public async Task Sapplique_aussi_a_une_base_vide() - { - await Migrateur.MigrateAsync(); - - Assert.Empty(await _db.LivresSouhaites.ToListAsync()); - } - - private async Task ExecuterAsync(string sql) - { - await using var commande = _connexion.CreateCommand(); - commande.CommandText = sql; - await commande.ExecuteNonQueryAsync(); - } - - private async Task> RangsAsync(string utilisateur) - { - // Contexte neuf : le précédent a pu mettre en cache le schéma d'avant la migration. - await using var db = new MaBibliDbContext( - new DbContextOptionsBuilder().UseSqlite(_connexion).Options); - - return await db.LivresSouhaites - .Where(s => s.Utilisateur == utilisateur) - .OrderBy(s => s.Rang) - .Select(s => new ValueTuple(s.Rang, s.Titre)) - .ToListAsync(); - } - - public void Dispose() - { - _db.Dispose(); - _connexion.Dispose(); - GC.SuppressFinalize(this); - } -}