From 739f157fbc2b97f02ee9f5bf795c0adf347405e6 Mon Sep 17 00:00:00 2001 From: tonyfages Date: Tue, 12 Mar 2024 17:22:44 +0100 Subject: [PATCH] =?UTF-8?q?fix=20bd=20+=20pb=20Tests=20Unit=20=F0=9F=90=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.idea/.idea.Verax_API_EF/.idea/vcs.xml | 1 + .../API/Entity_FrameWork.Article.db | Bin 45056 -> 49152 bytes .../API/Entity_FrameWork.Article.db-shm | Bin 0 -> 32768 bytes .../API/Entity_FrameWork.Article.db-wal | 0 Verax_API_EF/Verax_API_EF/API/Program.cs | 2 +- .../Verax_API_EF/DbContextLib/Class1.cs | 89 ------------------ .../DbContextLib/LibraryContext.cs | 1 - ...ner.cs => 20240312155559_mrg1.Designer.cs} | 68 +++++-------- ...1132206_mrg1.cs => 20240312155559_mrg1.cs} | 63 ++++++------- .../Migrations/LibraryContextModelSnapshot.cs | 66 +++++-------- 10 files changed, 83 insertions(+), 207 deletions(-) create mode 100644 Verax_API_EF/Verax_API_EF/API/Entity_FrameWork.Article.db-shm create mode 100644 Verax_API_EF/Verax_API_EF/API/Entity_FrameWork.Article.db-wal delete mode 100644 Verax_API_EF/Verax_API_EF/DbContextLib/Class1.cs rename Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/{20240311132206_mrg1.Designer.cs => 20240312155559_mrg1.Designer.cs} (86%) rename Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/{20240311132206_mrg1.cs => 20240312155559_mrg1.cs} (75%) diff --git a/Verax_API_EF/Verax_API_EF/.idea/.idea.Verax_API_EF/.idea/vcs.xml b/Verax_API_EF/Verax_API_EF/.idea/.idea.Verax_API_EF/.idea/vcs.xml index 6c0b863..64713b8 100644 --- a/Verax_API_EF/Verax_API_EF/.idea/.idea.Verax_API_EF/.idea/vcs.xml +++ b/Verax_API_EF/Verax_API_EF/.idea/.idea.Verax_API_EF/.idea/vcs.xml @@ -1,6 +1,7 @@ + \ No newline at end of file diff --git a/Verax_API_EF/Verax_API_EF/API/Entity_FrameWork.Article.db b/Verax_API_EF/Verax_API_EF/API/Entity_FrameWork.Article.db index 3cd9f2fccd0232de535751d05a4a7a8a6200ad97..175a9e3bfb33888228bcc9beffeb72eedaac90e5 100644 GIT binary patch delta 1064 zcmb_Z&rcIU6yDisJGAyWIu<0Ov9@@6Gq)eKWJk&&=T4 zwMf3BUO4O|ZCu4FJajF%5^|%fPF#0>7kbDO()PHxMiW7Bof8vLpO%`%sP(DG0|yT+b~UC&wV2iw(c-GnW>y01Ww}p3I%}jkAVdiU(XBqZC;E{< zRjHZj9HG~wQOoeU^y2?XDoo>-^R!bePTGypXCt&-4$Ia|39UCl?+adfS3X2v$#cz3 z4u{g=L!9wVX?LT1vWlyKdvCgD&kTWzJ?+CA96{Am^|1s=9I z*nzE5mHG}`P9FP^88@ao-8HhGgAI5DQ_v0mQdK1YZnP7+nry(wY=kZ*>v1b4G?F}p zn|MN}lZ{wKgsREfYKh}GJFIZ93*X=~e1H{(e+Fkote`}0q!6_W*uzf4aT~#I6dz1s zy%0+eT;fIS6}xh&cqZ#ISYGNZUtkm7!poBX`cpV(w;(nX!@wpTFY(xm%5YvlSP>1m zvY%z0X`9XT8kU)#CD240awE*-?UD_75Y`RYj3cj`!?F!|5pU9oHqoThjbSKojA#K0 zjA{rf8nA20@Gm^dC%gav delta 848 zcmbVJ-%Auh9N*cQb#`X&{GO7XddjVvh?|<;8U{&J#9Bw-#c7~KEY{tFX$sdtMIc^A zy%Z$#7~xw!)kF6W^b&|c5s?)6V3ha}!AWKhMl^f3M$lU?^Zmi+^O?_QW_A|OuBrFq z$e1@z)pI(kRKJDC;YZ=&ki)i&@A?Q`rlZB0$os0UX-=d4F;u7D=X^ zY~DM2C7W}n^5gmI$xN^_#3j0~Bbl+x)SzhvOUrDx{>EB%!C*9+v{4};p3#!YMH7u$5dn#_nc-Lj;ZJ=dVqXe@?qv;5eF$!wq-6egzh=i&&9Y2{nQIo>HU ztU2Mk7)Yhv1Kp|qoNUFQc8i=mm~aQHzj zO(c39r>C#D9sdP?hMjH};TTpFD8VOKk-xMAjRwXs6ubyFR5=8Xsfki*Z>ULu*RTjz z;V3jo0teEf>5BO1#YrEL%?m@45!R|67-1uNpmHG6T7y1RU`yL8lUR9Q0dVZo{| zBNG)j>k9mYAFwI?tQTv{H(-}T1X2868jyJi4gz2(`IK!aN%%XMKf@!H*cGe~`wcXN B&&vP+ diff --git a/Verax_API_EF/Verax_API_EF/API/Entity_FrameWork.Article.db-shm b/Verax_API_EF/Verax_API_EF/API/Entity_FrameWork.Article.db-shm new file mode 100644 index 0000000000000000000000000000000000000000..fe9ac2845eca6fe6da8a63cd096d9cf9e24ece10 GIT binary patch literal 32768 zcmeIuAr62r3(); -//libraryContext.Database.EnsureCreated(); +//libraryContext.Database.EnsureCreated(); libraryContext.Database.Migrate(); app.Run(); diff --git a/Verax_API_EF/Verax_API_EF/DbContextLib/Class1.cs b/Verax_API_EF/Verax_API_EF/DbContextLib/Class1.cs deleted file mode 100644 index 6ef8d5f..0000000 --- a/Verax_API_EF/Verax_API_EF/DbContextLib/Class1.cs +++ /dev/null @@ -1,89 +0,0 @@ -using DbContextLib; -using Entities; -using Microsoft.EntityFrameworkCore; - -namespace StubbedContextLib; - -public class StubbedContext : LibraryContext -{ - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - base.OnModelCreating(modelBuilder); - - modelBuilder.Entity().HasData( - new ArticleEntity - { - Id = 1, - Title = "Breaking News Elisabeth 2 Died", - Description = "The queen of England died today at the age of 95", - DatePublished = "2022-02-06", - LectureTime = 2, - Author = "Tom Smith" - - }, - new ArticleEntity - { - Id = 2, - Title = "The new iPhone 15", - Description = "The new iPhone 15 is out and it's the best phone ever", - DatePublished = "2022-02-06", - LectureTime = 3, - Author = "Tom Smith" - - }, - new ArticleEntity - { - Id = 3, - Title = "M&M's new recipe", - Description = "M&M's new recipe is out and it's the best chocolate ever", - DatePublished = "2022-02-06", - LectureTime = 1, - Author = "M&M's Red" - } - ); - - modelBuilder.Entity().HasData( - new UserEntity - { - Nom = "Fages", Prenom = "Tony", Pseudo = "TonyF", Mail = "tony@gmail.com", Mdp = "1234", Role = "Admin" - }, - new UserEntity - { - Nom = "Smith", Prenom = "Tom", Pseudo = "TomS", Mail = "tom@mail.com", Mdp = "1234", - Role = "User" - }, - new UserEntity - { - Nom = "M&M's", Prenom = "Red", Pseudo = "RedM", Mail = "M&M#mail.com", Mdp = "1234", Role = "Modérator" - } - ); - - modelBuilder.Entity().HasData( - new ArticleUserEntity - { - ArticleEntityId = 1, - UserEntityPseudo = "Sha" - }, - new ArticleUserEntity - { - ArticleEntityId = 2, - UserEntityPseudo = "Sha" - }, - new ArticleUserEntity - { - ArticleEntityId = 3, - UserEntityPseudo = "Sha" - }, - new ArticleUserEntity - { - ArticleEntityId = 3, - UserEntityPseudo = "Sha" - }, - new ArticleUserEntity - { - ArticleEntityId = 2, - UserEntityPseudo = "Sha" - } - ); - } -} \ No newline at end of file diff --git a/Verax_API_EF/Verax_API_EF/DbContextLib/LibraryContext.cs b/Verax_API_EF/Verax_API_EF/DbContextLib/LibraryContext.cs index 8923007..053406d 100644 --- a/Verax_API_EF/Verax_API_EF/DbContextLib/LibraryContext.cs +++ b/Verax_API_EF/Verax_API_EF/DbContextLib/LibraryContext.cs @@ -51,7 +51,6 @@ public class LibraryContext : DbContext .HasOne(f => f.User) .WithMany(u => u.Forms) .HasForeignKey(f => f.UserEntityPseudo); - /* modelBuilder.Entity().HasData( new ArticleEntity diff --git a/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240311132206_mrg1.Designer.cs b/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240312155559_mrg1.Designer.cs similarity index 86% rename from Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240311132206_mrg1.Designer.cs rename to Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240312155559_mrg1.Designer.cs index 6c21748..850cf0c 100644 --- a/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240311132206_mrg1.Designer.cs +++ b/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240312155559_mrg1.Designer.cs @@ -10,7 +10,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace DbContextLib.Migrations { [DbContext(typeof(LibraryContext))] - [Migration("20240311132206_mrg1")] + [Migration("20240312155559_mrg1")] partial class mrg1 { /// @@ -83,12 +83,12 @@ namespace DbContextLib.Migrations b.Property("ArticleEntityId") .HasColumnType("INTEGER"); - b.Property("UserEntityId") - .HasColumnType("INTEGER"); + b.Property("UserEntityPseudo") + .HasColumnType("TEXT"); - b.HasKey("ArticleEntityId", "UserEntityId"); + b.HasKey("ArticleEntityId", "UserEntityPseudo"); - b.HasIndex("UserEntityId"); + b.HasIndex("UserEntityPseudo"); b.ToTable("ArticleUserSet"); @@ -96,27 +96,27 @@ namespace DbContextLib.Migrations new { ArticleEntityId = 1L, - UserEntityId = 1L + UserEntityPseudo = "TonyF" }, new { ArticleEntityId = 2L, - UserEntityId = 2L + UserEntityPseudo = "NoaSil" }, new { ArticleEntityId = 3L, - UserEntityId = 3L + UserEntityPseudo = "Sha" }, new { ArticleEntityId = 3L, - UserEntityId = 1L + UserEntityPseudo = "RedM" }, new { ArticleEntityId = 2L, - UserEntityId = 3L + UserEntityPseudo = "TomS" }); }); @@ -134,20 +134,17 @@ namespace DbContextLib.Migrations .IsRequired() .HasColumnType("TEXT"); - b.Property("Pseudo") + b.Property("Theme") .IsRequired() .HasColumnType("TEXT"); - b.Property("Theme") + b.Property("UserEntityPseudo") .IsRequired() .HasColumnType("TEXT"); - b.Property("UserEntityId") - .HasColumnType("INTEGER"); - b.HasKey("Id"); - b.HasIndex("UserEntityId"); + b.HasIndex("UserEntityPseudo"); b.ToTable("FormSet"); @@ -157,35 +154,31 @@ namespace DbContextLib.Migrations Id = 1L, DatePublication = "Form 1 Description", Link = "hhtp://form1.com", - Pseudo = "Form 1", Theme = "", - UserEntityId = 1L + UserEntityPseudo = "Sha" }, new { Id = 2L, DatePublication = "Form 2 Description", Link = "hhtp://form2.com", - Pseudo = "Form 2", Theme = "", - UserEntityId = 2L + UserEntityPseudo = "Sha" }, new { Id = 3L, DatePublication = "Form 3 Description", Link = "hhtp://form3.com", - Pseudo = "Form 3", Theme = "", - UserEntityId = 3L + UserEntityPseudo = "Sha" }); }); modelBuilder.Entity("Entities.UserEntity", b => { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + b.Property("Pseudo") + .HasColumnType("TEXT"); b.Property("Mail") .IsRequired() @@ -203,67 +196,58 @@ namespace DbContextLib.Migrations .IsRequired() .HasColumnType("TEXT"); - b.Property("Pseudo") - .IsRequired() - .HasColumnType("TEXT"); - b.Property("Role") .IsRequired() .HasColumnType("TEXT"); - b.HasKey("Id"); + b.HasKey("Pseudo"); b.ToTable("UserSet"); b.HasData( new { - Id = 1L, + Pseudo = "TonyF", Mail = "tony@gmail.com", Mdp = "1234", Nom = "Fages", Prenom = "Tony", - Pseudo = "TonyF", Role = "Admin" }, new { - Id = 2L, + Pseudo = "TomS", Mail = "tom@mail.com", Mdp = "1234", Nom = "Smith", Prenom = "Tom", - Pseudo = "TomS", Role = "User" }, new { - Id = 3L, + Pseudo = "RedM", Mail = "M&M#mail.com", Mdp = "1234", Nom = "M&M's", Prenom = "Red", - Pseudo = "RedM", Role = "Modérator" }, new { - Id = 4L, + Pseudo = "Sha", Mail = "ShaCasca@gmail.com", Mdp = "1234", Nom = "Cascarra", Prenom = "Cascarra", - Pseudo = "Sha", Role = "Admin" }, new { - Id = 5L, + Pseudo = "NoaSil", Mail = "", Mdp = "1234", Nom = "Sillard", Prenom = "Noa", - Pseudo = "NoaSil", Role = "Admin" }); }); @@ -278,7 +262,7 @@ namespace DbContextLib.Migrations b.HasOne("Entities.UserEntity", null) .WithMany() - .HasForeignKey("UserEntityId") + .HasForeignKey("UserEntityPseudo") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); @@ -287,7 +271,7 @@ namespace DbContextLib.Migrations { b.HasOne("Entities.UserEntity", "User") .WithMany("Forms") - .HasForeignKey("UserEntityId") + .HasForeignKey("UserEntityPseudo") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); diff --git a/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240311132206_mrg1.cs b/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240312155559_mrg1.cs similarity index 75% rename from Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240311132206_mrg1.cs rename to Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240312155559_mrg1.cs index b9278d6..df6fd44 100644 --- a/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240311132206_mrg1.cs +++ b/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/20240312155559_mrg1.cs @@ -33,8 +33,6 @@ namespace DbContextLib.Migrations name: "UserSet", columns: table => new { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), Pseudo = table.Column(type: "TEXT", nullable: false), Mdp = table.Column(type: "TEXT", nullable: false), Nom = table.Column(type: "TEXT", nullable: false), @@ -44,19 +42,19 @@ namespace DbContextLib.Migrations }, constraints: table => { - table.PrimaryKey("PK_UserSet", x => x.Id); + table.PrimaryKey("PK_UserSet", x => x.Pseudo); }); migrationBuilder.CreateTable( name: "ArticleUserSet", columns: table => new { - UserEntityId = table.Column(type: "INTEGER", nullable: false), + UserEntityPseudo = table.Column(type: "TEXT", nullable: false), ArticleEntityId = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { - table.PrimaryKey("PK_ArticleUserSet", x => new { x.ArticleEntityId, x.UserEntityId }); + table.PrimaryKey("PK_ArticleUserSet", x => new { x.ArticleEntityId, x.UserEntityPseudo }); table.ForeignKey( name: "FK_ArticleUserSet_ArticleSet_ArticleEntityId", column: x => x.ArticleEntityId, @@ -64,10 +62,10 @@ namespace DbContextLib.Migrations principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( - name: "FK_ArticleUserSet_UserSet_UserEntityId", - column: x => x.UserEntityId, + name: "FK_ArticleUserSet_UserSet_UserEntityPseudo", + column: x => x.UserEntityPseudo, principalTable: "UserSet", - principalColumn: "Id", + principalColumn: "Pseudo", onDelete: ReferentialAction.Cascade); }); @@ -80,17 +78,16 @@ namespace DbContextLib.Migrations Theme = table.Column(type: "TEXT", nullable: false), DatePublication = table.Column(type: "TEXT", nullable: false), Link = table.Column(type: "TEXT", nullable: false), - Pseudo = table.Column(type: "TEXT", nullable: false), - UserEntityId = table.Column(type: "INTEGER", nullable: false) + UserEntityPseudo = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_FormSet", x => x.Id); table.ForeignKey( - name: "FK_FormSet_UserSet_UserEntityId", - column: x => x.UserEntityId, + name: "FK_FormSet_UserSet_UserEntityPseudo", + column: x => x.UserEntityPseudo, principalTable: "UserSet", - principalColumn: "Id", + principalColumn: "Pseudo", onDelete: ReferentialAction.Cascade); }); @@ -106,47 +103,47 @@ namespace DbContextLib.Migrations migrationBuilder.InsertData( table: "UserSet", - columns: new[] { "Id", "Mail", "Mdp", "Nom", "Prenom", "Pseudo", "Role" }, + columns: new[] { "Pseudo", "Mail", "Mdp", "Nom", "Prenom", "Role" }, values: new object[,] { - { 1L, "tony@gmail.com", "1234", "Fages", "Tony", "TonyF", "Admin" }, - { 2L, "tom@mail.com", "1234", "Smith", "Tom", "TomS", "User" }, - { 3L, "M&M#mail.com", "1234", "M&M's", "Red", "RedM", "Modérator" }, - { 4L, "ShaCasca@gmail.com", "1234", "Cascarra", "Cascarra", "Sha", "Admin" }, - { 5L, "", "1234", "Sillard", "Noa", "NoaSil", "Admin" } + { "NoaSil", "", "1234", "Sillard", "Noa", "Admin" }, + { "RedM", "M&M#mail.com", "1234", "M&M's", "Red", "Modérator" }, + { "Sha", "ShaCasca@gmail.com", "1234", "Cascarra", "Cascarra", "Admin" }, + { "TomS", "tom@mail.com", "1234", "Smith", "Tom", "User" }, + { "TonyF", "tony@gmail.com", "1234", "Fages", "Tony", "Admin" } }); migrationBuilder.InsertData( table: "ArticleUserSet", - columns: new[] { "ArticleEntityId", "UserEntityId" }, + columns: new[] { "ArticleEntityId", "UserEntityPseudo" }, values: new object[,] { - { 1L, 1L }, - { 2L, 2L }, - { 2L, 3L }, - { 3L, 1L }, - { 3L, 3L } + { 1L, "TonyF" }, + { 2L, "NoaSil" }, + { 2L, "TomS" }, + { 3L, "RedM" }, + { 3L, "Sha" } }); migrationBuilder.InsertData( table: "FormSet", - columns: new[] { "Id", "DatePublication", "Link", "Pseudo", "Theme", "UserEntityId" }, + columns: new[] { "Id", "DatePublication", "Link", "Theme", "UserEntityPseudo" }, values: new object[,] { - { 1L, "Form 1 Description", "hhtp://form1.com", "Form 1", "", 1L }, - { 2L, "Form 2 Description", "hhtp://form2.com", "Form 2", "", 2L }, - { 3L, "Form 3 Description", "hhtp://form3.com", "Form 3", "", 3L } + { 1L, "Form 1 Description", "hhtp://form1.com", "", "Sha" }, + { 2L, "Form 2 Description", "hhtp://form2.com", "", "Sha" }, + { 3L, "Form 3 Description", "hhtp://form3.com", "", "Sha" } }); migrationBuilder.CreateIndex( - name: "IX_ArticleUserSet_UserEntityId", + name: "IX_ArticleUserSet_UserEntityPseudo", table: "ArticleUserSet", - column: "UserEntityId"); + column: "UserEntityPseudo"); migrationBuilder.CreateIndex( - name: "IX_FormSet_UserEntityId", + name: "IX_FormSet_UserEntityPseudo", table: "FormSet", - column: "UserEntityId"); + column: "UserEntityPseudo"); } /// diff --git a/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/LibraryContextModelSnapshot.cs b/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/LibraryContextModelSnapshot.cs index 4e992dc..8cff281 100644 --- a/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/LibraryContextModelSnapshot.cs +++ b/Verax_API_EF/Verax_API_EF/DbContextLib/Migrations/LibraryContextModelSnapshot.cs @@ -80,12 +80,12 @@ namespace DbContextLib.Migrations b.Property("ArticleEntityId") .HasColumnType("INTEGER"); - b.Property("UserEntityId") - .HasColumnType("INTEGER"); + b.Property("UserEntityPseudo") + .HasColumnType("TEXT"); - b.HasKey("ArticleEntityId", "UserEntityId"); + b.HasKey("ArticleEntityId", "UserEntityPseudo"); - b.HasIndex("UserEntityId"); + b.HasIndex("UserEntityPseudo"); b.ToTable("ArticleUserSet"); @@ -93,27 +93,27 @@ namespace DbContextLib.Migrations new { ArticleEntityId = 1L, - UserEntityId = 1L + UserEntityPseudo = "TonyF" }, new { ArticleEntityId = 2L, - UserEntityId = 2L + UserEntityPseudo = "NoaSil" }, new { ArticleEntityId = 3L, - UserEntityId = 3L + UserEntityPseudo = "Sha" }, new { ArticleEntityId = 3L, - UserEntityId = 1L + UserEntityPseudo = "RedM" }, new { ArticleEntityId = 2L, - UserEntityId = 3L + UserEntityPseudo = "TomS" }); }); @@ -131,20 +131,17 @@ namespace DbContextLib.Migrations .IsRequired() .HasColumnType("TEXT"); - b.Property("Pseudo") + b.Property("Theme") .IsRequired() .HasColumnType("TEXT"); - b.Property("Theme") + b.Property("UserEntityPseudo") .IsRequired() .HasColumnType("TEXT"); - b.Property("UserEntityId") - .HasColumnType("INTEGER"); - b.HasKey("Id"); - b.HasIndex("UserEntityId"); + b.HasIndex("UserEntityPseudo"); b.ToTable("FormSet"); @@ -154,35 +151,31 @@ namespace DbContextLib.Migrations Id = 1L, DatePublication = "Form 1 Description", Link = "hhtp://form1.com", - Pseudo = "Form 1", Theme = "", - UserEntityId = 1L + UserEntityPseudo = "Sha" }, new { Id = 2L, DatePublication = "Form 2 Description", Link = "hhtp://form2.com", - Pseudo = "Form 2", Theme = "", - UserEntityId = 2L + UserEntityPseudo = "Sha" }, new { Id = 3L, DatePublication = "Form 3 Description", Link = "hhtp://form3.com", - Pseudo = "Form 3", Theme = "", - UserEntityId = 3L + UserEntityPseudo = "Sha" }); }); modelBuilder.Entity("Entities.UserEntity", b => { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + b.Property("Pseudo") + .HasColumnType("TEXT"); b.Property("Mail") .IsRequired() @@ -200,67 +193,58 @@ namespace DbContextLib.Migrations .IsRequired() .HasColumnType("TEXT"); - b.Property("Pseudo") - .IsRequired() - .HasColumnType("TEXT"); - b.Property("Role") .IsRequired() .HasColumnType("TEXT"); - b.HasKey("Id"); + b.HasKey("Pseudo"); b.ToTable("UserSet"); b.HasData( new { - Id = 1L, + Pseudo = "TonyF", Mail = "tony@gmail.com", Mdp = "1234", Nom = "Fages", Prenom = "Tony", - Pseudo = "TonyF", Role = "Admin" }, new { - Id = 2L, + Pseudo = "TomS", Mail = "tom@mail.com", Mdp = "1234", Nom = "Smith", Prenom = "Tom", - Pseudo = "TomS", Role = "User" }, new { - Id = 3L, + Pseudo = "RedM", Mail = "M&M#mail.com", Mdp = "1234", Nom = "M&M's", Prenom = "Red", - Pseudo = "RedM", Role = "Modérator" }, new { - Id = 4L, + Pseudo = "Sha", Mail = "ShaCasca@gmail.com", Mdp = "1234", Nom = "Cascarra", Prenom = "Cascarra", - Pseudo = "Sha", Role = "Admin" }, new { - Id = 5L, + Pseudo = "NoaSil", Mail = "", Mdp = "1234", Nom = "Sillard", Prenom = "Noa", - Pseudo = "NoaSil", Role = "Admin" }); }); @@ -275,7 +259,7 @@ namespace DbContextLib.Migrations b.HasOne("Entities.UserEntity", null) .WithMany() - .HasForeignKey("UserEntityId") + .HasForeignKey("UserEntityPseudo") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); @@ -284,7 +268,7 @@ namespace DbContextLib.Migrations { b.HasOne("Entities.UserEntity", "User") .WithMany("Forms") - .HasForeignKey("UserEntityId") + .HasForeignKey("UserEntityPseudo") .OnDelete(DeleteBehavior.Cascade) .IsRequired();