Added a name field to text elements
This commit is contained in:
parent
4b2d3a10a3
commit
aa641770d2
@ -44,6 +44,7 @@ public sealed class DataContext : DbContext
|
||||
|
||||
modelBuilder.Entity<TextElement>().HasIndex(n => n.Id);
|
||||
modelBuilder.Entity<TextElement>().HasIndex(n => n.Code);
|
||||
modelBuilder.Entity<TextElement>().HasIndex(n => n.Name);
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -7,9 +7,11 @@ public sealed class TextElement
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
public string Code { get; set; } = string.Empty;
|
||||
|
||||
public Section Section { get; set; }
|
||||
|
||||
public List<Translation> Translations { get; set; }
|
||||
public List<Translation> Translations { get; set; } = new();
|
||||
}
|
201
I18N Commander/DataModel/Migrations/20220710172935_202207AddTextElementName.Designer.cs
generated
Normal file
201
I18N Commander/DataModel/Migrations/20220710172935_202207AddTextElementName.Designer.cs
generated
Normal file
@ -0,0 +1,201 @@
|
||||
// <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("20220710172935_202207AddTextElementName")]
|
||||
partial class _202207AddTextElementName
|
||||
{
|
||||
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<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("SectionId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Code");
|
||||
|
||||
b.HasIndex("Id");
|
||||
|
||||
b.HasIndex("Name");
|
||||
|
||||
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 _202207AddTextElementName : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Name",
|
||||
table: "TextElements",
|
||||
type: "TEXT",
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TextElements_Name",
|
||||
table: "TextElements",
|
||||
column: "Name");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_TextElements_Name",
|
||||
table: "TextElements");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Name",
|
||||
table: "TextElements");
|
||||
}
|
||||
}
|
||||
}
|
@ -103,6 +103,10 @@ namespace DataModel.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("SectionId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
@ -112,6 +116,8 @@ namespace DataModel.Migrations
|
||||
|
||||
b.HasIndex("Id");
|
||||
|
||||
b.HasIndex("Name");
|
||||
|
||||
b.HasIndex("SectionId");
|
||||
|
||||
b.ToTable("TextElements");
|
||||
|
Loading…
Reference in New Issue
Block a user