From 62b36a68a767bc04aeedf9e6a867ffa0cf9729a4 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sun, 12 Jun 2022 21:46:42 +0200 Subject: [PATCH] Added migration for main entities --- ...12194509_202206AddMainEntities.Designer.cs | 186 ++++++++++++++++++ .../20220612194509_202206AddMainEntities.cs | 135 +++++++++++++ .../Migrations/DataContextModelSnapshot.cs | 121 ++++++++++++ project for migrations.i18nc | Bin 0 -> 45056 bytes 4 files changed, 442 insertions(+) create mode 100644 I18N Commander/DataModel/Migrations/20220612194509_202206AddMainEntities.Designer.cs create mode 100644 I18N Commander/DataModel/Migrations/20220612194509_202206AddMainEntities.cs diff --git a/I18N Commander/DataModel/Migrations/20220612194509_202206AddMainEntities.Designer.cs b/I18N Commander/DataModel/Migrations/20220612194509_202206AddMainEntities.Designer.cs new file mode 100644 index 0000000..8a363f7 --- /dev/null +++ b/I18N Commander/DataModel/Migrations/20220612194509_202206AddMainEntities.Designer.cs @@ -0,0 +1,186 @@ +// +using System; +using DataModel.Database.Common; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace DataModel.Migrations +{ + [DbContext(typeof(DataContext))] + [Migration("20220612194509_202206AddMainEntities")] + partial class _202206AddMainEntities + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.5"); + + modelBuilder.Entity("DataModel.Database.Section", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ParentId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Id"); + + b.HasIndex("Name"); + + b.HasIndex("ParentId"); + + b.ToTable("Sections"); + }); + + modelBuilder.Entity("DataModel.Database.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BoolValue") + .HasColumnType("INTEGER"); + + b.Property("GuidValue") + .HasColumnType("TEXT"); + + b.Property("IntegerValue") + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("TextValue") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("BoolValue"); + + b.HasIndex("GuidValue"); + + b.HasIndex("Id"); + + b.HasIndex("IntegerValue"); + + b.HasIndex("Name") + .IsUnique(); + + b.HasIndex("TextValue"); + + b.ToTable("Settings"); + }); + + modelBuilder.Entity("DataModel.Database.TextElement", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Code") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SectionId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Code"); + + b.HasIndex("Id"); + + b.HasIndex("SectionId"); + + b.ToTable("TextElements"); + }); + + modelBuilder.Entity("DataModel.Database.Translation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Culture") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Text") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("TextElementId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Culture"); + + b.HasIndex("Id"); + + b.HasIndex("Text"); + + b.HasIndex("TextElementId"); + + b.ToTable("Translations"); + }); + + modelBuilder.Entity("DataModel.Database.Section", b => + { + b.HasOne("DataModel.Database.Section", "Parent") + .WithMany() + .HasForeignKey("ParentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("DataModel.Database.TextElement", b => + { + b.HasOne("DataModel.Database.Section", "Section") + .WithMany("TextElements") + .HasForeignKey("SectionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Section"); + }); + + modelBuilder.Entity("DataModel.Database.Translation", b => + { + b.HasOne("DataModel.Database.TextElement", "TextElement") + .WithMany("Translations") + .HasForeignKey("TextElementId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TextElement"); + }); + + modelBuilder.Entity("DataModel.Database.Section", b => + { + b.Navigation("TextElements"); + }); + + modelBuilder.Entity("DataModel.Database.TextElement", b => + { + b.Navigation("Translations"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/I18N Commander/DataModel/Migrations/20220612194509_202206AddMainEntities.cs b/I18N Commander/DataModel/Migrations/20220612194509_202206AddMainEntities.cs new file mode 100644 index 0000000..e9a2cad --- /dev/null +++ b/I18N Commander/DataModel/Migrations/20220612194509_202206AddMainEntities.cs @@ -0,0 +1,135 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace DataModel.Migrations +{ + public partial class _202206AddMainEntities : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Sections", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(type: "TEXT", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Sections", x => x.Id); + table.ForeignKey( + name: "FK_Sections_Sections_ParentId", + column: x => x.ParentId, + principalTable: "Sections", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "TextElements", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Code = table.Column(type: "TEXT", nullable: false), + SectionId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TextElements", x => x.Id); + table.ForeignKey( + name: "FK_TextElements_Sections_SectionId", + column: x => x.SectionId, + principalTable: "Sections", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Translations", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + TextElementId = table.Column(type: "INTEGER", nullable: false), + Culture = table.Column(type: "TEXT", nullable: false), + Text = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Translations", x => x.Id); + table.ForeignKey( + name: "FK_Translations_TextElements_TextElementId", + column: x => x.TextElementId, + principalTable: "TextElements", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Sections_Id", + table: "Sections", + column: "Id"); + + migrationBuilder.CreateIndex( + name: "IX_Sections_Name", + table: "Sections", + column: "Name"); + + migrationBuilder.CreateIndex( + name: "IX_Sections_ParentId", + table: "Sections", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_TextElements_Code", + table: "TextElements", + column: "Code"); + + migrationBuilder.CreateIndex( + name: "IX_TextElements_Id", + table: "TextElements", + column: "Id"); + + migrationBuilder.CreateIndex( + name: "IX_TextElements_SectionId", + table: "TextElements", + column: "SectionId"); + + migrationBuilder.CreateIndex( + name: "IX_Translations_Culture", + table: "Translations", + column: "Culture"); + + migrationBuilder.CreateIndex( + name: "IX_Translations_Id", + table: "Translations", + column: "Id"); + + migrationBuilder.CreateIndex( + name: "IX_Translations_Text", + table: "Translations", + column: "Text"); + + migrationBuilder.CreateIndex( + name: "IX_Translations_TextElementId", + table: "Translations", + column: "TextElementId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Translations"); + + migrationBuilder.DropTable( + name: "TextElements"); + + migrationBuilder.DropTable( + name: "Sections"); + } + } +} diff --git a/I18N Commander/DataModel/Migrations/DataContextModelSnapshot.cs b/I18N Commander/DataModel/Migrations/DataContextModelSnapshot.cs index 4bfc41b..fd8d8b5 100644 --- a/I18N Commander/DataModel/Migrations/DataContextModelSnapshot.cs +++ b/I18N Commander/DataModel/Migrations/DataContextModelSnapshot.cs @@ -17,6 +17,30 @@ namespace DataModel.Migrations #pragma warning disable 612, 618 modelBuilder.HasAnnotation("ProductVersion", "6.0.5"); + modelBuilder.Entity("DataModel.Database.Section", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ParentId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Id"); + + b.HasIndex("Name"); + + b.HasIndex("ParentId"); + + b.ToTable("Sections"); + }); + modelBuilder.Entity("DataModel.Database.Setting", b => { b.Property("Id") @@ -57,6 +81,103 @@ namespace DataModel.Migrations b.ToTable("Settings"); }); + + modelBuilder.Entity("DataModel.Database.TextElement", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Code") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("SectionId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Code"); + + b.HasIndex("Id"); + + b.HasIndex("SectionId"); + + b.ToTable("TextElements"); + }); + + modelBuilder.Entity("DataModel.Database.Translation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Culture") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Text") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("TextElementId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Culture"); + + b.HasIndex("Id"); + + b.HasIndex("Text"); + + b.HasIndex("TextElementId"); + + b.ToTable("Translations"); + }); + + modelBuilder.Entity("DataModel.Database.Section", b => + { + b.HasOne("DataModel.Database.Section", "Parent") + .WithMany() + .HasForeignKey("ParentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("DataModel.Database.TextElement", b => + { + b.HasOne("DataModel.Database.Section", "Section") + .WithMany("TextElements") + .HasForeignKey("SectionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Section"); + }); + + modelBuilder.Entity("DataModel.Database.Translation", b => + { + b.HasOne("DataModel.Database.TextElement", "TextElement") + .WithMany("Translations") + .HasForeignKey("TextElementId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TextElement"); + }); + + modelBuilder.Entity("DataModel.Database.Section", b => + { + b.Navigation("TextElements"); + }); + + modelBuilder.Entity("DataModel.Database.TextElement", b => + { + b.Navigation("Translations"); + }); #pragma warning restore 612, 618 } } diff --git a/project for migrations.i18nc b/project for migrations.i18nc index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..fce11e30828c4fcf4aac4a9b664928fa703a4b0f 100644 GIT binary patch literal 45056 zcmeI&O-~v@7{KveR8W-C8|lGhvhBf*)(A#DH7VMy-6#vQsbXf6R@vh#uDtTg4d90|a z@=^#zQ9|-ql!ssD<;kpnA)nQO^GT;6Wj*^b7XPh8qd%2L-{N0lpJVx@UrQgBo-KY| zJdl+X1Q0*~0R#|0009L4pTK1_lGs^RZ)25O*}XA~&avxxmD)wqvE3W*q*QIWe$C=u z-bmYqFs)ZcQD|fPY9eb1&3}a^R8h6|+D%ii%%j5CZ0+8o zi8{4goFb<3@t4`0r8bJ^+LLqiPpU8%`+uqI!r->uF>63ff#C%qHXH}{`s15pN7 zXDljY(M&l5rez!ZMqXH1TUdp|L$Q~&j_rI})(b6n(7P`*k;|KzbpBKv7^fm#u(PHm z<7W)ZUh9UtU!S&7l##m8{HFfhAjY=$nMU4_A0n{yCid#jZ7@+Rs^1n>IoUhvUACj; zIL7Nt<)TsYD)n0PO{MA88}G+fhJub``^a0qtI&(t)(s4Hn07*-0cU^gxkkO*I`>Z8 zMpM4op|EmjW+009IL zKmY**5I_I{1Q0*~fd?h9qRwOzsf|=>V>_8jZY7hOo6h}Zy4?HDZhL)WeJd)*rN)0K z@7Qdp VhyVfzAb