137 lines
6.2 KiB
C#
137 lines
6.2 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
namespace DataStoring.EfCore.Migrations
|
|
{
|
|
public partial class TabellenAdded : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "BaustellenSet",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
AuftraggeberId = table.Column<int>(type: "integer", nullable: true),
|
|
Standort = table.Column<string>(type: "text", nullable: true),
|
|
Strasse = table.Column<string>(type: "text", nullable: true),
|
|
Ort = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_BaustellenSet", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_BaustellenSet_AuftraggeberSet_AuftraggeberId",
|
|
column: x => x.AuftraggeberId,
|
|
principalTable: "AuftraggeberSet",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "SewerObjectsSet",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
BauvorhabenId = table.Column<int>(type: "integer", nullable: true),
|
|
Objektname = table.Column<string>(type: "text", nullable: true),
|
|
ObereSchacht = table.Column<string>(type: "text", nullable: true),
|
|
UntereSchacht = table.Column<string>(type: "text", nullable: true),
|
|
ObjektLänge = table.Column<decimal>(type: "numeric", nullable: false),
|
|
Durchmesser = table.Column<decimal>(type: "numeric", nullable: false),
|
|
Bemerkung = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_SewerObjectsSet", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_SewerObjectsSet_BaustellenSet_BauvorhabenId",
|
|
column: x => x.BauvorhabenId,
|
|
principalTable: "BaustellenSet",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "PruefungSet",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
InspektionsobjektId = table.Column<int>(type: "integer", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_PruefungSet", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_PruefungSet_SewerObjectsSet_InspektionsobjektId",
|
|
column: x => x.InspektionsobjektId,
|
|
principalTable: "SewerObjectsSet",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "MessungenSet",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
EintragID = table.Column<int>(type: "integer", nullable: false),
|
|
Datum = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
|
Pressure = table.Column<string>(type: "text", nullable: true),
|
|
MeasureType = table.Column<int>(type: "integer", nullable: false),
|
|
PressureTestId = table.Column<int>(type: "integer", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_MessungenSet", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_MessungenSet_PruefungSet_PressureTestId",
|
|
column: x => x.PressureTestId,
|
|
principalTable: "PruefungSet",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_BaustellenSet_AuftraggeberId",
|
|
table: "BaustellenSet",
|
|
column: "AuftraggeberId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_MessungenSet_PressureTestId",
|
|
table: "MessungenSet",
|
|
column: "PressureTestId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_PruefungSet_InspektionsobjektId",
|
|
table: "PruefungSet",
|
|
column: "InspektionsobjektId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_SewerObjectsSet_BauvorhabenId",
|
|
table: "SewerObjectsSet",
|
|
column: "BauvorhabenId");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "MessungenSet");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "PruefungSet");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "SewerObjectsSet");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "BaustellenSet");
|
|
}
|
|
}
|
|
}
|