Enum verschoben zur Domain

Datenbank converter angefangen
This commit is contained in:
HuskyTeufel
2021-09-20 13:45:24 +02:00
parent f2ea55ea34
commit ea3352db79
18 changed files with 6925 additions and 47 deletions

View File

@@ -0,0 +1,271 @@
// <auto-generated />
using System;
using DaSaSo.EntityFramework;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace DaSaSo.EntityFramework.Migrations
{
[DbContext(typeof(DaSaSoDbContext))]
[Migration("20210920062903_transfertoenum")]
partial class transfertoenum
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 63)
.HasAnnotation("ProductVersion", "6.0.0-preview.7.21378.4")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
modelBuilder.Entity("DaSaSo.Domain.Model.Buildingsite", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("BuildingSiteNumber")
.HasColumnType("text");
b.Property<string>("ContactPerson")
.HasColumnType("text");
b.Property<string>("Country")
.HasColumnType("text");
b.Property<int?>("ProjectId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.ToTable("Buildingsites");
});
modelBuilder.Entity("DaSaSo.Domain.Model.Client", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Country")
.HasColumnType("text");
b.Property<string>("Firstname")
.HasColumnType("text");
b.Property<string>("LastName")
.HasColumnType("text");
b.Property<string>("Postcode")
.HasColumnType("text");
b.Property<string>("Street")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Clients");
});
modelBuilder.Entity("DaSaSo.Domain.Model.Project", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int?>("ClientId")
.HasColumnType("integer");
b.Property<string>("Name")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("Projects");
});
modelBuilder.Entity("DaSaSo.Domain.Model.SewerDamage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("DamageType")
.HasColumnType("integer");
b.Property<decimal>("Distance")
.HasColumnType("numeric");
b.Property<int>("PreparationType")
.HasColumnType("integer");
b.Property<int?>("SewerObjectId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("SewerObjectId");
b.ToTable("SewerDamages");
});
modelBuilder.Entity("DaSaSo.Domain.Model.SewerObject", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int?>("BuildingSiteId")
.HasColumnType("integer");
b.Property<bool>("BuildingsiteBarier")
.HasColumnType("boolean");
b.Property<int>("DN")
.HasColumnType("integer");
b.Property<string>("Material")
.HasColumnType("text");
b.Property<string>("ObjektName")
.HasColumnType("text");
b.Property<bool>("PermitNeeded")
.HasColumnType("boolean");
b.Property<int?>("PunktObenId")
.HasColumnType("integer");
b.Property<int>("PunktObenType")
.HasColumnType("integer");
b.Property<int?>("PunktUntenId")
.HasColumnType("integer");
b.Property<int>("PunktUntenType")
.HasColumnType("integer");
b.Property<bool>("SewerActivated")
.HasColumnType("boolean");
b.Property<bool>("SewerCleaned")
.HasColumnType("boolean");
b.Property<decimal>("SewerLength")
.HasColumnType("numeric");
b.Property<string>("StreetName")
.HasColumnType("text");
b.Property<bool>("WaterBarrier")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("BuildingSiteId");
b.HasIndex("PunktObenId");
b.HasIndex("PunktUntenId");
b.ToTable("SewerObjects");
});
modelBuilder.Entity("DaSaSo.Domain.Model.SewerPoint", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Objektnummer")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("SewerPoint");
});
modelBuilder.Entity("DaSaSo.Domain.Model.Buildingsite", b =>
{
b.HasOne("DaSaSo.Domain.Model.Project", "Project")
.WithMany("BuildingSites")
.HasForeignKey("ProjectId");
b.Navigation("Project");
});
modelBuilder.Entity("DaSaSo.Domain.Model.Project", b =>
{
b.HasOne("DaSaSo.Domain.Model.Client", "Client")
.WithMany("Projects")
.HasForeignKey("ClientId");
b.Navigation("Client");
});
modelBuilder.Entity("DaSaSo.Domain.Model.SewerDamage", b =>
{
b.HasOne("DaSaSo.Domain.Model.SewerObject", "SewerObject")
.WithMany("SewerDamages")
.HasForeignKey("SewerObjectId");
b.Navigation("SewerObject");
});
modelBuilder.Entity("DaSaSo.Domain.Model.SewerObject", b =>
{
b.HasOne("DaSaSo.Domain.Model.Buildingsite", "BuildingSite")
.WithMany("SewerObjects")
.HasForeignKey("BuildingSiteId");
b.HasOne("DaSaSo.Domain.Model.SewerPoint", "PunktOben")
.WithMany()
.HasForeignKey("PunktObenId");
b.HasOne("DaSaSo.Domain.Model.SewerPoint", "PunktUnten")
.WithMany()
.HasForeignKey("PunktUntenId");
b.Navigation("BuildingSite");
b.Navigation("PunktOben");
b.Navigation("PunktUnten");
});
modelBuilder.Entity("DaSaSo.Domain.Model.Buildingsite", b =>
{
b.Navigation("SewerObjects");
});
modelBuilder.Entity("DaSaSo.Domain.Model.Client", b =>
{
b.Navigation("Projects");
});
modelBuilder.Entity("DaSaSo.Domain.Model.Project", b =>
{
b.Navigation("BuildingSites");
});
modelBuilder.Entity("DaSaSo.Domain.Model.SewerObject", b =>
{
b.Navigation("SewerDamages");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,134 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace DaSaSo.EntityFramework.Migrations
{
public partial class transfertoenum : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PointFrom",
table: "SewerObjects");
migrationBuilder.DropColumn(
name: "PointTo",
table: "SewerObjects");
migrationBuilder.AddColumn<int>(
name: "PunktObenId",
table: "SewerObjects",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "PunktObenType",
table: "SewerObjects",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "PunktUntenId",
table: "SewerObjects",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "PunktUntenType",
table: "SewerObjects",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateTable(
name: "SewerPoint",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Objektnummer = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_SewerPoint", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_SewerObjects_PunktObenId",
table: "SewerObjects",
column: "PunktObenId");
migrationBuilder.CreateIndex(
name: "IX_SewerObjects_PunktUntenId",
table: "SewerObjects",
column: "PunktUntenId");
migrationBuilder.AddForeignKey(
name: "FK_SewerObjects_SewerPoint_PunktObenId",
table: "SewerObjects",
column: "PunktObenId",
principalTable: "SewerPoint",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_SewerObjects_SewerPoint_PunktUntenId",
table: "SewerObjects",
column: "PunktUntenId",
principalTable: "SewerPoint",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_SewerObjects_SewerPoint_PunktObenId",
table: "SewerObjects");
migrationBuilder.DropForeignKey(
name: "FK_SewerObjects_SewerPoint_PunktUntenId",
table: "SewerObjects");
migrationBuilder.DropTable(
name: "SewerPoint");
migrationBuilder.DropIndex(
name: "IX_SewerObjects_PunktObenId",
table: "SewerObjects");
migrationBuilder.DropIndex(
name: "IX_SewerObjects_PunktUntenId",
table: "SewerObjects");
migrationBuilder.DropColumn(
name: "PunktObenId",
table: "SewerObjects");
migrationBuilder.DropColumn(
name: "PunktObenType",
table: "SewerObjects");
migrationBuilder.DropColumn(
name: "PunktUntenId",
table: "SewerObjects");
migrationBuilder.DropColumn(
name: "PunktUntenType",
table: "SewerObjects");
migrationBuilder.AddColumn<string>(
name: "PointFrom",
table: "SewerObjects",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "PointTo",
table: "SewerObjects",
type: "text",
nullable: true);
}
}
}

View File

@@ -143,11 +143,17 @@ namespace DaSaSo.EntityFramework.Migrations
b.Property<bool>("PermitNeeded")
.HasColumnType("boolean");
b.Property<string>("PointFrom")
.HasColumnType("text");
b.Property<int?>("PunktObenId")
.HasColumnType("integer");
b.Property<string>("PointTo")
.HasColumnType("text");
b.Property<int>("PunktObenType")
.HasColumnType("integer");
b.Property<int?>("PunktUntenId")
.HasColumnType("integer");
b.Property<int>("PunktUntenType")
.HasColumnType("integer");
b.Property<bool>("SewerActivated")
.HasColumnType("boolean");
@@ -168,9 +174,28 @@ namespace DaSaSo.EntityFramework.Migrations
b.HasIndex("BuildingSiteId");
b.HasIndex("PunktObenId");
b.HasIndex("PunktUntenId");
b.ToTable("SewerObjects");
});
modelBuilder.Entity("DaSaSo.Domain.Model.SewerPoint", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Objektnummer")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("SewerPoint");
});
modelBuilder.Entity("DaSaSo.Domain.Model.Buildingsite", b =>
{
b.HasOne("DaSaSo.Domain.Model.Project", "Project")
@@ -204,7 +229,19 @@ namespace DaSaSo.EntityFramework.Migrations
.WithMany("SewerObjects")
.HasForeignKey("BuildingSiteId");
b.HasOne("DaSaSo.Domain.Model.SewerPoint", "PunktOben")
.WithMany()
.HasForeignKey("PunktObenId");
b.HasOne("DaSaSo.Domain.Model.SewerPoint", "PunktUnten")
.WithMany()
.HasForeignKey("PunktUntenId");
b.Navigation("BuildingSite");
b.Navigation("PunktOben");
b.Navigation("PunktUnten");
});
modelBuilder.Entity("DaSaSo.Domain.Model.Buildingsite", b =>