Changed section data model
- Made parents nullable - Added a data key for the tree - Added depth for quicker layer-wise loading
This commit is contained in:
parent
1ddb6ef1e7
commit
c90d3fdd3c
@ -35,6 +35,8 @@ public sealed class DataContext : DbContext
|
|||||||
|
|
||||||
modelBuilder.Entity<Section>().HasIndex(n => n.Id);
|
modelBuilder.Entity<Section>().HasIndex(n => n.Id);
|
||||||
modelBuilder.Entity<Section>().HasIndex(n => n.Name);
|
modelBuilder.Entity<Section>().HasIndex(n => n.Name);
|
||||||
|
modelBuilder.Entity<Section>().HasIndex(n => n.Depth);
|
||||||
|
modelBuilder.Entity<Section>().HasIndex(n => n.DataKey);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -9,7 +9,11 @@ public sealed class Section
|
|||||||
|
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
public Section Parent { get; set; }
|
public string DataKey { get; set; } = string.Empty;
|
||||||
|
|
||||||
public List<TextElement> TextElements { get; set; }
|
public int Depth { get; set; } = 0;
|
||||||
|
|
||||||
|
public Section? Parent { get; set; }
|
||||||
|
|
||||||
|
public List<TextElement> TextElements { get; set; } = new();
|
||||||
}
|
}
|
184
I18N Commander/DataModel/Migrations/20220626195157_202206MadeParentNullable.Designer.cs
generated
Normal file
184
I18N Commander/DataModel/Migrations/20220626195157_202206MadeParentNullable.Designer.cs
generated
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
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("20220626195157_202206MadeParentNullable")]
|
||||||
|
partial class _202206MadeParentNullable
|
||||||
|
{
|
||||||
|
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<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("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<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("BoolValue")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<Guid>("GuidValue")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("IntegerValue")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("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<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Code")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("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<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Culture")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Text")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("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");
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace DataModel.Migrations
|
||||||
|
{
|
||||||
|
public partial class _202206MadeParentNullable : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Sections_Sections_ParentId",
|
||||||
|
table: "Sections");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "ParentId",
|
||||||
|
table: "Sections",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "INTEGER");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Sections_Sections_ParentId",
|
||||||
|
table: "Sections",
|
||||||
|
column: "ParentId",
|
||||||
|
principalTable: "Sections",
|
||||||
|
principalColumn: "Id");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Sections_Sections_ParentId",
|
||||||
|
table: "Sections");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "ParentId",
|
||||||
|
table: "Sections",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "INTEGER",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Sections_Sections_ParentId",
|
||||||
|
table: "Sections",
|
||||||
|
column: "ParentId",
|
||||||
|
principalTable: "Sections",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
190
I18N Commander/DataModel/Migrations/20220709094035_202207AddSectionDataKey.Designer.cs
generated
Normal file
190
I18N Commander/DataModel/Migrations/20220709094035_202207AddSectionDataKey.Designer.cs
generated
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
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("20220709094035_202207AddSectionDataKey")]
|
||||||
|
partial class _202207AddSectionDataKey
|
||||||
|
{
|
||||||
|
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<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("DataKey")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("ParentId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("DataKey");
|
||||||
|
|
||||||
|
b.HasIndex("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Name");
|
||||||
|
|
||||||
|
b.HasIndex("ParentId");
|
||||||
|
|
||||||
|
b.ToTable("Sections");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DataModel.Database.Setting", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("BoolValue")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<Guid>("GuidValue")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("IntegerValue")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("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<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Code")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("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<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Culture")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Text")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("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");
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace DataModel.Migrations
|
||||||
|
{
|
||||||
|
public partial class _202207AddSectionDataKey : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "DataKey",
|
||||||
|
table: "Sections",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Sections_DataKey",
|
||||||
|
table: "Sections",
|
||||||
|
column: "DataKey");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Sections_DataKey",
|
||||||
|
table: "Sections");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "DataKey",
|
||||||
|
table: "Sections");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
195
I18N Commander/DataModel/Migrations/20220709095404_202207AddSectionDepth.Designer.cs
generated
Normal file
195
I18N Commander/DataModel/Migrations/20220709095404_202207AddSectionDepth.Designer.cs
generated
Normal file
@ -0,0 +1,195 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
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("20220709095404_202207AddSectionDepth")]
|
||||||
|
partial class _202207AddSectionDepth
|
||||||
|
{
|
||||||
|
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<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("DataKey")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("Depth")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("ParentId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("DataKey");
|
||||||
|
|
||||||
|
b.HasIndex("Depth");
|
||||||
|
|
||||||
|
b.HasIndex("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Name");
|
||||||
|
|
||||||
|
b.HasIndex("ParentId");
|
||||||
|
|
||||||
|
b.ToTable("Sections");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DataModel.Database.Setting", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("BoolValue")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<Guid>("GuidValue")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("IntegerValue")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("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<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Code")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("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<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Culture")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Text")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("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");
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace DataModel.Migrations
|
||||||
|
{
|
||||||
|
public partial class _202207AddSectionDepth : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "Depth",
|
||||||
|
table: "Sections",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Sections_Depth",
|
||||||
|
table: "Sections",
|
||||||
|
column: "Depth");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Sections_Depth",
|
||||||
|
table: "Sections");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Depth",
|
||||||
|
table: "Sections");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -23,15 +23,26 @@ namespace DataModel.Migrations
|
|||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("DataKey")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("Depth")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<int>("ParentId")
|
b.Property<int?>("ParentId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("DataKey");
|
||||||
|
|
||||||
|
b.HasIndex("Depth");
|
||||||
|
|
||||||
b.HasIndex("Id");
|
b.HasIndex("Id");
|
||||||
|
|
||||||
b.HasIndex("Name");
|
b.HasIndex("Name");
|
||||||
@ -140,9 +151,7 @@ namespace DataModel.Migrations
|
|||||||
{
|
{
|
||||||
b.HasOne("DataModel.Database.Section", "Parent")
|
b.HasOne("DataModel.Database.Section", "Parent")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("ParentId")
|
.HasForeignKey("ParentId");
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Parent");
|
b.Navigation("Parent");
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user