From ab8fde8b44808a4d5f36c20946531e868dc3c1cd Mon Sep 17 00:00:00 2001 From: Louison PARANT Date: Thu, 9 Feb 2023 15:15:57 +0100 Subject: [PATCH] push bdd (manque plus que dicos) --- .../DBContexts/SQLiteContext.cs | 7 +- Sources/EntityFrameworkLOL/DBLOL.db | Bin 98304 -> 131072 bytes ...nClassEntity.cs => ChampionClassEntity.cs} | 0 .../Entities/ChampionEntity.cs | 3 +- .../Entities/SkillEntity.cs | 4 +- .../Entities/SkillTypeEntity.cs | 2 + ...230209135613_MigrationWallah5.Designer.cs} | 70 +++++++++++++++++- ....cs => 20230209135613_MigrationWallah5.cs} | 69 ++++++++++++++++- .../Migrations/SQLiteContextModelSnapshot.cs | 66 ++++++++++++++++- 9 files changed, 209 insertions(+), 12 deletions(-) rename Sources/EntityFrameworkLOL/Entities/{ChamionClassEntity.cs => ChampionClassEntity.cs} (100%) rename Sources/EntityFrameworkLOL/Migrations/{20230208161248_MigrationWallah4.Designer.cs => 20230209135613_MigrationWallah5.Designer.cs} (75%) rename Sources/EntityFrameworkLOL/Migrations/{20230208161248_MigrationWallah4.cs => 20230209135613_MigrationWallah5.cs} (74%) diff --git a/Sources/EntityFrameworkLOL/DBContexts/SQLiteContext.cs b/Sources/EntityFrameworkLOL/DBContexts/SQLiteContext.cs index dba6295..342cb78 100644 --- a/Sources/EntityFrameworkLOL/DBContexts/SQLiteContext.cs +++ b/Sources/EntityFrameworkLOL/DBContexts/SQLiteContext.cs @@ -9,7 +9,7 @@ namespace EntityFrameworkLOL.DBContexts public DbSet RuneFamily { get; set; } public DbSet Image { get; set; } public DbSet SkillType { get; set; } - //public DbSet Skill { get; set; } + public DbSet Skill { get; set; } public DbSet Skin { get; set; } public DbSet Rune { get; set; } public DbSet ChampionClass { get; set; } @@ -19,6 +19,11 @@ namespace EntityFrameworkLOL.DBContexts protected override void OnConfiguring(DbContextOptionsBuilder options) => options.UseSqlite($"Data Source=DBLOL.db"); + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + } + public SQLiteContext() { } diff --git a/Sources/EntityFrameworkLOL/DBLOL.db b/Sources/EntityFrameworkLOL/DBLOL.db index b647dff5e791fe42309bf5c1dfefa58464f9ff91..5ecb42a6c875dcf189120666a1dad7dc6c9d7131 100644 GIT binary patch delta 3139 zcmeHJO>7%Q6yDiguh(nuO#bY3e!X3{O56lv=a(RbkffWCx^W#lKmr2C5R+PLekduT z0#v6|4M>$}8Nnf{kjNoD0a8~SKq^0i3l$QG10X07;?Pq;a6qEU0cO{`jhomJ2o4qM z%5P@;=FRus%Xh7aGoaEYD@AxeJN;v2fo{0CF))KrfqIb|~^a$!iZuk>? z51xgy@E+(DuZf?Ct9rCzNlZ2)CMLB<+B+ick=|%WS9i1{J(in2npq+r$%7e9%N*(I z2}i>1&G06}&d#px(uVrAMnA0}@hXKj(EI3hbQHzWe#DUoK7gz68JL7&D2P|}sQi(L z!(n${Ilm~##K2Z;C0#;29R2}JHIOaW6EXT)Yg|Wqza?HvS7r5;q&LR4y)ia)9wG*g zv9^XtwVsKbM{D=~x;9<0mY3J^6&LfMqL)umkXxtFKKLDc>F+QSHDfco^Hb9bP&k+7~KaNu}-&u z0KP&GPfj#&QmX`x<>qIy&yG%739G=yCdD>cTt6B=piaulHWNiY94|^%Hj7W!rW3P*(zNPZs)QOgSYz?e0LjIL-(M?w%US>c delta 537 zcmZo@;Am)In;>asVsiXcbHq4m6$d%`ENE9*viP1AThmf8KW{I%k;+O zj3U#IEo0PV6rcWK8KVZH1Vl)8IinF%g4p!!%Yn+or{7-AXv-)%U2+AZJfqlj%N2}f zOa&s-RaY`<14RQ@GP*JfPoKV$Q5|R)kS8_$=1N8-iRL&#c5zWr#&-FV#H5_m;Oxvi z5Ek0LZw=!~MkaNk$@;8no0qcvWag~rVHcN|XKeJHyn@SevLUzF@v{My?&F)qSH>5_rw3HX!?#&a z?=GV!D6YhjFo-XPghhdD0U+iFVvstJJPd>QLO?7C#5|h?9oFzKa`>>QK>!&6007E> A1^@s6 diff --git a/Sources/EntityFrameworkLOL/Entities/ChamionClassEntity.cs b/Sources/EntityFrameworkLOL/Entities/ChampionClassEntity.cs similarity index 100% rename from Sources/EntityFrameworkLOL/Entities/ChamionClassEntity.cs rename to Sources/EntityFrameworkLOL/Entities/ChampionClassEntity.cs diff --git a/Sources/EntityFrameworkLOL/Entities/ChampionEntity.cs b/Sources/EntityFrameworkLOL/Entities/ChampionEntity.cs index bfd6593..0fe0c2d 100644 --- a/Sources/EntityFrameworkLOL/Entities/ChampionEntity.cs +++ b/Sources/EntityFrameworkLOL/Entities/ChampionEntity.cs @@ -32,6 +32,7 @@ namespace EntityFrameworkLOL.Entities public ImageEntity Image { get; set; } - //public ICollection Skills { get; set; } + //[NotMapped] + public virtual ICollection Skills { get; set; } } } \ No newline at end of file diff --git a/Sources/EntityFrameworkLOL/Entities/SkillEntity.cs b/Sources/EntityFrameworkLOL/Entities/SkillEntity.cs index dbefb19..ef50aa2 100644 --- a/Sources/EntityFrameworkLOL/Entities/SkillEntity.cs +++ b/Sources/EntityFrameworkLOL/Entities/SkillEntity.cs @@ -18,7 +18,7 @@ namespace EntityFrameworkLOL.Entities public SkillTypeEntity Type { get; set; } - [NotMapped] - public ICollection Champions { get; set; } + //[NotMapped] + public virtual ICollection Champions { get; set; } } } \ No newline at end of file diff --git a/Sources/EntityFrameworkLOL/Entities/SkillTypeEntity.cs b/Sources/EntityFrameworkLOL/Entities/SkillTypeEntity.cs index b17df20..f182d33 100644 --- a/Sources/EntityFrameworkLOL/Entities/SkillTypeEntity.cs +++ b/Sources/EntityFrameworkLOL/Entities/SkillTypeEntity.cs @@ -14,6 +14,8 @@ namespace EntityFrameworkLOL.Entities { [Key] [ForeignKey("SkillEntity")] + public int Id { get; set; } + public SkillType Type { get; set; } } } \ No newline at end of file diff --git a/Sources/EntityFrameworkLOL/Migrations/20230208161248_MigrationWallah4.Designer.cs b/Sources/EntityFrameworkLOL/Migrations/20230209135613_MigrationWallah5.Designer.cs similarity index 75% rename from Sources/EntityFrameworkLOL/Migrations/20230208161248_MigrationWallah4.Designer.cs rename to Sources/EntityFrameworkLOL/Migrations/20230209135613_MigrationWallah5.Designer.cs index e79b656..6015393 100644 --- a/Sources/EntityFrameworkLOL/Migrations/20230208161248_MigrationWallah4.Designer.cs +++ b/Sources/EntityFrameworkLOL/Migrations/20230209135613_MigrationWallah5.Designer.cs @@ -10,8 +10,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace EntityFrameworkLOL.Migrations { [DbContext(typeof(SQLiteContext))] - [Migration("20230208161248_MigrationWallah4")] - partial class MigrationWallah4 + [Migration("20230209135613_MigrationWallah5")] + partial class MigrationWallah5 { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -19,6 +19,21 @@ namespace EntityFrameworkLOL.Migrations #pragma warning disable 612, 618 modelBuilder.HasAnnotation("ProductVersion", "7.0.2"); + modelBuilder.Entity("ChampionEntitySkillEntity", b => + { + b.Property("ChampionsName") + .HasColumnType("TEXT"); + + b.Property("SkillsName") + .HasColumnType("TEXT"); + + b.HasKey("ChampionsName", "SkillsName"); + + b.HasIndex("SkillsName"); + + b.ToTable("ChampionEntitySkillEntity"); + }); + modelBuilder.Entity("EntityFrameworkLOL.Entities.CategoryEntity", b => { b.Property("Category") @@ -130,12 +145,35 @@ namespace EntityFrameworkLOL.Migrations b.ToTable("RunePage"); }); + modelBuilder.Entity("EntityFrameworkLOL.Entities.SkillEntity", b => + { + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("TypeId") + .HasColumnType("INTEGER"); + + b.HasKey("Name"); + + b.HasIndex("TypeId"); + + b.ToTable("Skill"); + }); + modelBuilder.Entity("EntityFrameworkLOL.Entities.SkillTypeEntity", b => { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + b.Property("Type") .HasColumnType("INTEGER"); - b.HasKey("Type"); + b.HasKey("Id"); b.ToTable("SkillType"); }); @@ -171,6 +209,21 @@ namespace EntityFrameworkLOL.Migrations b.ToTable("Skin"); }); + modelBuilder.Entity("ChampionEntitySkillEntity", b => + { + b.HasOne("EntityFrameworkLOL.Entities.ChampionEntity", null) + .WithMany() + .HasForeignKey("ChampionsName") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("EntityFrameworkLOL.Entities.SkillEntity", null) + .WithMany() + .HasForeignKey("SkillsName") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("EntityFrameworkLOL.Entities.ChampionEntity", b => { b.HasOne("EntityFrameworkLOL.Entities.ChampionClassEntity", "Class") @@ -207,6 +260,17 @@ namespace EntityFrameworkLOL.Migrations b.Navigation("Image"); }); + modelBuilder.Entity("EntityFrameworkLOL.Entities.SkillEntity", b => + { + b.HasOne("EntityFrameworkLOL.Entities.SkillTypeEntity", "Type") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Type"); + }); + modelBuilder.Entity("EntityFrameworkLOL.Entities.SkinEntity", b => { b.HasOne("EntityFrameworkLOL.Entities.ChampionEntity", "ChampionSkin") diff --git a/Sources/EntityFrameworkLOL/Migrations/20230208161248_MigrationWallah4.cs b/Sources/EntityFrameworkLOL/Migrations/20230209135613_MigrationWallah5.cs similarity index 74% rename from Sources/EntityFrameworkLOL/Migrations/20230208161248_MigrationWallah4.cs rename to Sources/EntityFrameworkLOL/Migrations/20230209135613_MigrationWallah5.cs index 2f96331..0e28b34 100644 --- a/Sources/EntityFrameworkLOL/Migrations/20230208161248_MigrationWallah4.cs +++ b/Sources/EntityFrameworkLOL/Migrations/20230209135613_MigrationWallah5.cs @@ -5,7 +5,7 @@ namespace EntityFrameworkLOL.Migrations { /// - public partial class MigrationWallah4 : Migration + public partial class MigrationWallah5 : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) @@ -73,11 +73,13 @@ namespace EntityFrameworkLOL.Migrations name: "SkillType", columns: table => new { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), Type = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { - table.PrimaryKey("PK_SkillType", x => x.Type); + table.PrimaryKey("PK_SkillType", x => x.Id); }); migrationBuilder.CreateTable( @@ -132,6 +134,25 @@ namespace EntityFrameworkLOL.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "Skill", + columns: table => new + { + Name = table.Column(type: "TEXT", nullable: false), + Description = table.Column(type: "TEXT", nullable: false), + TypeId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Skill", x => x.Name); + table.ForeignKey( + name: "FK_Skill_SkillType_TypeId", + column: x => x.TypeId, + principalTable: "SkillType", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "Skin", columns: table => new @@ -158,6 +179,30 @@ namespace EntityFrameworkLOL.Migrations principalColumn: "Base64"); }); + migrationBuilder.CreateTable( + name: "ChampionEntitySkillEntity", + columns: table => new + { + ChampionsName = table.Column(type: "TEXT", nullable: false), + SkillsName = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ChampionEntitySkillEntity", x => new { x.ChampionsName, x.SkillsName }); + table.ForeignKey( + name: "FK_ChampionEntitySkillEntity_Champion_ChampionsName", + column: x => x.ChampionsName, + principalTable: "Champion", + principalColumn: "Name", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ChampionEntitySkillEntity_Skill_SkillsName", + column: x => x.SkillsName, + principalTable: "Skill", + principalColumn: "Name", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateIndex( name: "IX_Champion_ClassId", table: "Champion", @@ -168,6 +213,11 @@ namespace EntityFrameworkLOL.Migrations table: "Champion", column: "ImageBase64"); + migrationBuilder.CreateIndex( + name: "IX_ChampionEntitySkillEntity_SkillsName", + table: "ChampionEntitySkillEntity", + column: "SkillsName"); + migrationBuilder.CreateIndex( name: "IX_Rune_FamilyId", table: "Rune", @@ -178,6 +228,11 @@ namespace EntityFrameworkLOL.Migrations table: "Rune", column: "ImageBase64"); + migrationBuilder.CreateIndex( + name: "IX_Skill_TypeId", + table: "Skill", + column: "TypeId"); + migrationBuilder.CreateIndex( name: "IX_Skin_ChampionSkinName", table: "Skin", @@ -195,6 +250,9 @@ namespace EntityFrameworkLOL.Migrations migrationBuilder.DropTable( name: "Category"); + migrationBuilder.DropTable( + name: "ChampionEntitySkillEntity"); + migrationBuilder.DropTable( name: "Rune"); @@ -202,10 +260,10 @@ namespace EntityFrameworkLOL.Migrations name: "RunePage"); migrationBuilder.DropTable( - name: "SkillType"); + name: "Skin"); migrationBuilder.DropTable( - name: "Skin"); + name: "Skill"); migrationBuilder.DropTable( name: "RuneFamily"); @@ -213,6 +271,9 @@ namespace EntityFrameworkLOL.Migrations migrationBuilder.DropTable( name: "Champion"); + migrationBuilder.DropTable( + name: "SkillType"); + migrationBuilder.DropTable( name: "ChampionClass"); diff --git a/Sources/EntityFrameworkLOL/Migrations/SQLiteContextModelSnapshot.cs b/Sources/EntityFrameworkLOL/Migrations/SQLiteContextModelSnapshot.cs index 85b39a6..6b00f17 100644 --- a/Sources/EntityFrameworkLOL/Migrations/SQLiteContextModelSnapshot.cs +++ b/Sources/EntityFrameworkLOL/Migrations/SQLiteContextModelSnapshot.cs @@ -16,6 +16,21 @@ namespace EntityFrameworkLOL.Migrations #pragma warning disable 612, 618 modelBuilder.HasAnnotation("ProductVersion", "7.0.2"); + modelBuilder.Entity("ChampionEntitySkillEntity", b => + { + b.Property("ChampionsName") + .HasColumnType("TEXT"); + + b.Property("SkillsName") + .HasColumnType("TEXT"); + + b.HasKey("ChampionsName", "SkillsName"); + + b.HasIndex("SkillsName"); + + b.ToTable("ChampionEntitySkillEntity"); + }); + modelBuilder.Entity("EntityFrameworkLOL.Entities.CategoryEntity", b => { b.Property("Category") @@ -127,12 +142,35 @@ namespace EntityFrameworkLOL.Migrations b.ToTable("RunePage"); }); + modelBuilder.Entity("EntityFrameworkLOL.Entities.SkillEntity", b => + { + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("TypeId") + .HasColumnType("INTEGER"); + + b.HasKey("Name"); + + b.HasIndex("TypeId"); + + b.ToTable("Skill"); + }); + modelBuilder.Entity("EntityFrameworkLOL.Entities.SkillTypeEntity", b => { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + b.Property("Type") .HasColumnType("INTEGER"); - b.HasKey("Type"); + b.HasKey("Id"); b.ToTable("SkillType"); }); @@ -168,6 +206,21 @@ namespace EntityFrameworkLOL.Migrations b.ToTable("Skin"); }); + modelBuilder.Entity("ChampionEntitySkillEntity", b => + { + b.HasOne("EntityFrameworkLOL.Entities.ChampionEntity", null) + .WithMany() + .HasForeignKey("ChampionsName") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("EntityFrameworkLOL.Entities.SkillEntity", null) + .WithMany() + .HasForeignKey("SkillsName") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("EntityFrameworkLOL.Entities.ChampionEntity", b => { b.HasOne("EntityFrameworkLOL.Entities.ChampionClassEntity", "Class") @@ -204,6 +257,17 @@ namespace EntityFrameworkLOL.Migrations b.Navigation("Image"); }); + modelBuilder.Entity("EntityFrameworkLOL.Entities.SkillEntity", b => + { + b.HasOne("EntityFrameworkLOL.Entities.SkillTypeEntity", "Type") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Type"); + }); + modelBuilder.Entity("EntityFrameworkLOL.Entities.SkinEntity", b => { b.HasOne("EntityFrameworkLOL.Entities.ChampionEntity", "ChampionSkin")