This commit is contained in:
Roland Fieger
2021-08-28 13:11:33 +02:00
parent 074df0adec
commit 2de05c3856
47 changed files with 2110 additions and 229 deletions

View File

@@ -0,0 +1,202 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Repositories;
namespace Repositories.Migrations
{
[DbContext(typeof(FwDbContext))]
[Migration("20210706081036_v1")]
partial class v1
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.16")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Datamodels.DatabaseModels.Address", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<long?>("AddressTypeId")
.HasColumnType("bigint");
b.Property<DateTime>("ChangedAt")
.HasColumnType("datetime(6)");
b.Property<string>("City")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)");
b.Property<long?>("PersonId")
.HasColumnType("bigint");
b.Property<string>("StreetName")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<int>("StreetNumber")
.HasColumnType("int");
b.Property<string>("Zip")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.HasKey("Id");
b.HasIndex("AddressTypeId");
b.HasIndex("PersonId");
b.ToTable("Address");
});
modelBuilder.Entity("Datamodels.DatabaseModels.Communication", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<DateTime>("ChangedAt")
.HasColumnType("datetime(6)");
b.Property<long?>("CommunicationTypeId")
.HasColumnType("bigint");
b.Property<string>("CommunicationValue")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)");
b.Property<long?>("PersonId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("CommunicationTypeId");
b.HasIndex("PersonId");
b.ToTable("Communication");
});
modelBuilder.Entity("Datamodels.DatabaseModels.Person", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<DateTime?>("Birthday")
.HasColumnType("datetime(6)");
b.Property<DateTime>("ChangedAt")
.HasColumnType("datetime(6)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)");
b.Property<string>("FirstName")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<long?>("GenderId")
.HasColumnType("bigint");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<string>("LastName")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.HasKey("Id");
b.HasIndex("GenderId");
b.ToTable("Person");
});
modelBuilder.Entity("Datamodels.Lookups.LookupCategory", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<string>("CategoryName")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.HasKey("Id");
b.ToTable("LookupCategories");
});
modelBuilder.Entity("Datamodels.Lookups.LookupValue", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<long?>("LookupCategoryId")
.HasColumnType("bigint");
b.Property<string>("Value")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.HasKey("Id");
b.HasIndex("LookupCategoryId");
b.ToTable("LookupValues");
});
modelBuilder.Entity("Datamodels.DatabaseModels.Address", b =>
{
b.HasOne("Datamodels.Lookups.LookupValue", "AddressType")
.WithMany()
.HasForeignKey("AddressTypeId");
b.HasOne("Datamodels.DatabaseModels.Person", "Person")
.WithMany("Addresses")
.HasForeignKey("PersonId");
});
modelBuilder.Entity("Datamodels.DatabaseModels.Communication", b =>
{
b.HasOne("Datamodels.Lookups.LookupValue", "CommunicationType")
.WithMany()
.HasForeignKey("CommunicationTypeId");
b.HasOne("Datamodels.DatabaseModels.Person", "Person")
.WithMany("Communications")
.HasForeignKey("PersonId");
});
modelBuilder.Entity("Datamodels.DatabaseModels.Person", b =>
{
b.HasOne("Datamodels.Lookups.LookupValue", "Gender")
.WithMany()
.HasForeignKey("GenderId");
});
modelBuilder.Entity("Datamodels.Lookups.LookupValue", b =>
{
b.HasOne("Datamodels.Lookups.LookupCategory", "LookupCategory")
.WithMany("LookupValues")
.HasForeignKey("LookupCategoryId");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,181 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Repositories.Migrations
{
public partial class v1 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "LookupCategories",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CategoryName = table.Column<string>(nullable: true),
IsActive = table.Column<bool>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LookupCategories", x => x.Id);
});
migrationBuilder.CreateTable(
name: "LookupValues",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Value = table.Column<string>(nullable: true),
IsActive = table.Column<bool>(nullable: false),
LookupCategoryId = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_LookupValues", x => x.Id);
table.ForeignKey(
name: "FK_LookupValues_LookupCategories_LookupCategoryId",
column: x => x.LookupCategoryId,
principalTable: "LookupCategories",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Person",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
LastName = table.Column<string>(nullable: true),
FirstName = table.Column<string>(nullable: true),
Birthday = table.Column<DateTime>(nullable: true),
IsActive = table.Column<bool>(nullable: false),
CreatedAt = table.Column<DateTime>(nullable: false),
ChangedAt = table.Column<DateTime>(nullable: false),
GenderId = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Person", x => x.Id);
table.ForeignKey(
name: "FK_Person_LookupValues_GenderId",
column: x => x.GenderId,
principalTable: "LookupValues",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Address",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
StreetName = table.Column<string>(nullable: true),
StreetNumber = table.Column<int>(nullable: false),
Zip = table.Column<string>(nullable: true),
City = table.Column<string>(nullable: true),
CreatedAt = table.Column<DateTime>(nullable: false),
ChangedAt = table.Column<DateTime>(nullable: false),
AddressTypeId = table.Column<long>(nullable: true),
PersonId = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Address", x => x.Id);
table.ForeignKey(
name: "FK_Address_LookupValues_AddressTypeId",
column: x => x.AddressTypeId,
principalTable: "LookupValues",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Address_Person_PersonId",
column: x => x.PersonId,
principalTable: "Person",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Communication",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CommunicationValue = table.Column<string>(nullable: true),
CommunicationTypeId = table.Column<long>(nullable: true),
CreatedAt = table.Column<DateTime>(nullable: false),
ChangedAt = table.Column<DateTime>(nullable: false),
PersonId = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Communication", x => x.Id);
table.ForeignKey(
name: "FK_Communication_LookupValues_CommunicationTypeId",
column: x => x.CommunicationTypeId,
principalTable: "LookupValues",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Communication_Person_PersonId",
column: x => x.PersonId,
principalTable: "Person",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_Address_AddressTypeId",
table: "Address",
column: "AddressTypeId");
migrationBuilder.CreateIndex(
name: "IX_Address_PersonId",
table: "Address",
column: "PersonId");
migrationBuilder.CreateIndex(
name: "IX_Communication_CommunicationTypeId",
table: "Communication",
column: "CommunicationTypeId");
migrationBuilder.CreateIndex(
name: "IX_Communication_PersonId",
table: "Communication",
column: "PersonId");
migrationBuilder.CreateIndex(
name: "IX_LookupValues_LookupCategoryId",
table: "LookupValues",
column: "LookupCategoryId");
migrationBuilder.CreateIndex(
name: "IX_Person_GenderId",
table: "Person",
column: "GenderId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Address");
migrationBuilder.DropTable(
name: "Communication");
migrationBuilder.DropTable(
name: "Person");
migrationBuilder.DropTable(
name: "LookupValues");
migrationBuilder.DropTable(
name: "LookupCategories");
}
}
}

View File

@@ -0,0 +1,200 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Repositories;
namespace Repositories.Migrations
{
[DbContext(typeof(FwDbContext))]
partial class FwDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.16")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Datamodels.DatabaseModels.Address", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<long?>("AddressTypeId")
.HasColumnType("bigint");
b.Property<DateTime>("ChangedAt")
.HasColumnType("datetime(6)");
b.Property<string>("City")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)");
b.Property<long?>("PersonId")
.HasColumnType("bigint");
b.Property<string>("StreetName")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<int>("StreetNumber")
.HasColumnType("int");
b.Property<string>("Zip")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.HasKey("Id");
b.HasIndex("AddressTypeId");
b.HasIndex("PersonId");
b.ToTable("Address");
});
modelBuilder.Entity("Datamodels.DatabaseModels.Communication", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<DateTime>("ChangedAt")
.HasColumnType("datetime(6)");
b.Property<long?>("CommunicationTypeId")
.HasColumnType("bigint");
b.Property<string>("CommunicationValue")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)");
b.Property<long?>("PersonId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("CommunicationTypeId");
b.HasIndex("PersonId");
b.ToTable("Communication");
});
modelBuilder.Entity("Datamodels.DatabaseModels.Person", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<DateTime?>("Birthday")
.HasColumnType("datetime(6)");
b.Property<DateTime>("ChangedAt")
.HasColumnType("datetime(6)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)");
b.Property<string>("FirstName")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<long?>("GenderId")
.HasColumnType("bigint");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<string>("LastName")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.HasKey("Id");
b.HasIndex("GenderId");
b.ToTable("Person");
});
modelBuilder.Entity("Datamodels.Lookups.LookupCategory", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<string>("CategoryName")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.HasKey("Id");
b.ToTable("LookupCategories");
});
modelBuilder.Entity("Datamodels.Lookups.LookupValue", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<long?>("LookupCategoryId")
.HasColumnType("bigint");
b.Property<string>("Value")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.HasKey("Id");
b.HasIndex("LookupCategoryId");
b.ToTable("LookupValues");
});
modelBuilder.Entity("Datamodels.DatabaseModels.Address", b =>
{
b.HasOne("Datamodels.Lookups.LookupValue", "AddressType")
.WithMany()
.HasForeignKey("AddressTypeId");
b.HasOne("Datamodels.DatabaseModels.Person", "Person")
.WithMany("Addresses")
.HasForeignKey("PersonId");
});
modelBuilder.Entity("Datamodels.DatabaseModels.Communication", b =>
{
b.HasOne("Datamodels.Lookups.LookupValue", "CommunicationType")
.WithMany()
.HasForeignKey("CommunicationTypeId");
b.HasOne("Datamodels.DatabaseModels.Person", "Person")
.WithMany("Communications")
.HasForeignKey("PersonId");
});
modelBuilder.Entity("Datamodels.DatabaseModels.Person", b =>
{
b.HasOne("Datamodels.Lookups.LookupValue", "Gender")
.WithMany()
.HasForeignKey("GenderId");
});
modelBuilder.Entity("Datamodels.Lookups.LookupValue", b =>
{
b.HasOne("Datamodels.Lookups.LookupCategory", "LookupCategory")
.WithMany("LookupValues")
.HasForeignKey("LookupCategoryId");
});
#pragma warning restore 612, 618
}
}
}