Um neue Projekte hinzuzufügen sollte man update ausführen
This commit is contained in:
322
KanSan.Base/Migrations/20200225192255_InitialCommit.cs
Normal file
322
KanSan.Base/Migrations/20200225192255_InitialCommit.cs
Normal file
@@ -0,0 +1,322 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace KanSan.Base.Migrations
|
||||
{
|
||||
public partial class InitialCommit : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Fahrzeuge",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
GuidNr = table.Column<Guid>(nullable: false),
|
||||
Kennzeichen = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Fahrzeuge", x => x.ID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Kunden",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
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: "LeitungsverzeichnisPositionen",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
GuidNr = table.Column<Guid>(nullable: false),
|
||||
Positionsnummer = table.Column<string>(nullable: true),
|
||||
Beschreibung = table.Column<string>(nullable: true),
|
||||
Einheit = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LeitungsverzeichnisPositionen", x => x.ID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Sanierungskonzept",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
GuidNr = table.Column<Guid>(nullable: false),
|
||||
SanierungsTyp = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Sanierungskonzept", x => x.ID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SewerPoints",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
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("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
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: "Taetigkeiten",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
GuidNr = table.Column<Guid>(nullable: false),
|
||||
SanierungskonzeptID = table.Column<int>(nullable: true),
|
||||
FahrzeugID = table.Column<int>(nullable: true),
|
||||
Mitarbeiter = table.Column<string>(nullable: true),
|
||||
ZeitStempel = table.Column<DateTime>(nullable: false),
|
||||
Position = table.Column<decimal>(nullable: false),
|
||||
LeitungsverzeichnisPositionID = table.Column<int>(nullable: true),
|
||||
Anzahl = table.Column<decimal>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Taetigkeiten", x => x.ID);
|
||||
table.ForeignKey(
|
||||
name: "FK_Taetigkeiten_Fahrzeuge_FahrzeugID",
|
||||
column: x => x.FahrzeugID,
|
||||
principalTable: "Fahrzeuge",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_Taetigkeiten_LeitungsverzeichnisPositionen_Leitungsverzeich~",
|
||||
column: x => x.LeitungsverzeichnisPositionID,
|
||||
principalTable: "LeitungsverzeichnisPositionen",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_Taetigkeiten_Sanierungskonzept_SanierungskonzeptID",
|
||||
column: x => x.SanierungskonzeptID,
|
||||
principalTable: "Sanierungskonzept",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Baustelle",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
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("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
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.CreateTable(
|
||||
name: "Schaeden",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
GuidNr = table.Column<Guid>(nullable: false),
|
||||
SewerID = table.Column<int>(nullable: true),
|
||||
SanierungsTyp = table.Column<int>(nullable: false),
|
||||
SanierungskonzeptID = table.Column<int>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Schaeden", x => x.ID);
|
||||
table.ForeignKey(
|
||||
name: "FK_Schaeden_Sanierungskonzept_SanierungskonzeptID",
|
||||
column: x => x.SanierungskonzeptID,
|
||||
principalTable: "Sanierungskonzept",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_Schaeden_Kanaele_SewerID",
|
||||
column: x => x.SewerID,
|
||||
principalTable: "Kanaele",
|
||||
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");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Schaeden_SanierungskonzeptID",
|
||||
table: "Schaeden",
|
||||
column: "SanierungskonzeptID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Schaeden_SewerID",
|
||||
table: "Schaeden",
|
||||
column: "SewerID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Taetigkeiten_FahrzeugID",
|
||||
table: "Taetigkeiten",
|
||||
column: "FahrzeugID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Taetigkeiten_LeitungsverzeichnisPositionID",
|
||||
table: "Taetigkeiten",
|
||||
column: "LeitungsverzeichnisPositionID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Taetigkeiten_SanierungskonzeptID",
|
||||
table: "Taetigkeiten",
|
||||
column: "SanierungskonzeptID");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Schaeden");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Taetigkeiten");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Kanaele");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Fahrzeuge");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "LeitungsverzeichnisPositionen");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Sanierungskonzept");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Baustelle");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SewerPoints");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Projekte");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Kunden");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user