Files
Kansan/KanSan.Base/Migrations/20200221084801_InitialCommit.cs
2020-02-21 09:50:32 +01:00

172 lines
6.9 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace KanSan.Base.Migrations
{
public partial class InitialCommit : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Kunden",
columns: table => new
{
ID = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
GuidNr = table.Column<Guid>(nullable: false),
Vorname = table.Column<string>(nullable: true),
Nachname = table.Column<string>(nullable: true),
Strasse = table.Column<string>(nullable: true),
PLZ = table.Column<string>(nullable: true),
Ort = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Kunden", x => x.ID);
});
migrationBuilder.CreateTable(
name: "SewerPoints",
columns: table => new
{
ID = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
GuidNr = table.Column<Guid>(nullable: false),
Objektnummer = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_SewerPoints", x => x.ID);
});
migrationBuilder.CreateTable(
name: "Projekte",
columns: table => new
{
ID = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
GuidNr = table.Column<Guid>(nullable: false),
KundeID = table.Column<int>(nullable: true),
Ort = table.Column<string>(nullable: true),
Projektnummer = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Projekte", x => x.ID);
table.ForeignKey(
name: "FK_Projekte_Kunden_KundeID",
column: x => x.KundeID,
principalTable: "Kunden",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Baustelle",
columns: table => new
{
ID = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
GuidNr = table.Column<Guid>(nullable: false),
ProjektID = table.Column<int>(nullable: true),
OrtTeil = table.Column<string>(nullable: true),
BaustelleNummer = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Baustelle", x => x.ID);
table.ForeignKey(
name: "FK_Baustelle_Projekte_ProjektID",
column: x => x.ProjektID,
principalTable: "Projekte",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Kanaele",
columns: table => new
{
ID = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
GuidNr = table.Column<Guid>(nullable: false),
BaustelleID = table.Column<int>(nullable: true),
StrasseName = table.Column<string>(nullable: true),
ObjektNummer = table.Column<string>(nullable: true),
SewerType = table.Column<int>(nullable: false),
PunktTypeOben = table.Column<int>(nullable: false),
PunktObenID = table.Column<int>(nullable: true),
PunktTypeUnten = table.Column<int>(nullable: false),
PunktUntenID = table.Column<int>(nullable: true),
DN = table.Column<int>(nullable: false),
Material = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Kanaele", x => x.ID);
table.ForeignKey(
name: "FK_Kanaele_Baustelle_BaustelleID",
column: x => x.BaustelleID,
principalTable: "Baustelle",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Kanaele_SewerPoints_PunktObenID",
column: x => x.PunktObenID,
principalTable: "SewerPoints",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Kanaele_SewerPoints_PunktUntenID",
column: x => x.PunktUntenID,
principalTable: "SewerPoints",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_Baustelle_ProjektID",
table: "Baustelle",
column: "ProjektID");
migrationBuilder.CreateIndex(
name: "IX_Kanaele_BaustelleID",
table: "Kanaele",
column: "BaustelleID");
migrationBuilder.CreateIndex(
name: "IX_Kanaele_PunktObenID",
table: "Kanaele",
column: "PunktObenID");
migrationBuilder.CreateIndex(
name: "IX_Kanaele_PunktUntenID",
table: "Kanaele",
column: "PunktUntenID");
migrationBuilder.CreateIndex(
name: "IX_Projekte_KundeID",
table: "Projekte",
column: "KundeID");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Kanaele");
migrationBuilder.DropTable(
name: "Baustelle");
migrationBuilder.DropTable(
name: "SewerPoints");
migrationBuilder.DropTable(
name: "Projekte");
migrationBuilder.DropTable(
name: "Kunden");
}
}
}