116 lines
4.7 KiB
C#
116 lines
4.7 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
namespace KanSan.Migrations
|
|
{
|
|
public partial class InitialCreate : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Kunden",
|
|
columns: table => new
|
|
{
|
|
KundenID = table.Column<Guid>(nullable: false),
|
|
Vorname = table.Column<string>(nullable: true),
|
|
Nachname = table.Column<string>(nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Kunden", x => x.KundenID);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Leistungsverzeichnisses",
|
|
columns: table => new
|
|
{
|
|
LeistungsverzeichnissID = table.Column<Guid>(nullable: false),
|
|
Position = table.Column<string>(nullable: true),
|
|
PositionBeschreibung = table.Column<string>(nullable: true),
|
|
PositionEinheit = table.Column<string>(nullable: true),
|
|
PositionEinheitspreis = table.Column<decimal>(nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Leistungsverzeichnisses", x => x.LeistungsverzeichnissID);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Baustellen",
|
|
columns: table => new
|
|
{
|
|
BaustelleID = table.Column<Guid>(nullable: false),
|
|
Ort = table.Column<string>(nullable: true),
|
|
Strasse = table.Column<string>(nullable: true),
|
|
KundenID = table.Column<Guid>(nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Baustellen", x => x.BaustelleID);
|
|
table.ForeignKey(
|
|
name: "FK_Baustellen_Kunden_KundenID",
|
|
column: x => x.KundenID,
|
|
principalTable: "Kunden",
|
|
principalColumn: "KundenID",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "leistungsverzeichnisBaustelle",
|
|
columns: table => new
|
|
{
|
|
LeistungsverzeichnisBaustelleID = table.Column<int>(nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
BaustelleID = table.Column<Guid>(nullable: true),
|
|
LeistungsverzeichnissID = table.Column<Guid>(nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_leistungsverzeichnisBaustelle", x => x.LeistungsverzeichnisBaustelleID);
|
|
table.ForeignKey(
|
|
name: "FK_leistungsverzeichnisBaustelle_Baustellen_BaustelleID",
|
|
column: x => x.BaustelleID,
|
|
principalTable: "Baustellen",
|
|
principalColumn: "BaustelleID",
|
|
onDelete: ReferentialAction.Restrict);
|
|
table.ForeignKey(
|
|
name: "FK_leistungsverzeichnisBaustelle_Leistungsverzeichnisses_LeistungsverzeichnissID",
|
|
column: x => x.LeistungsverzeichnissID,
|
|
principalTable: "Leistungsverzeichnisses",
|
|
principalColumn: "LeistungsverzeichnissID",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Baustellen_KundenID",
|
|
table: "Baustellen",
|
|
column: "KundenID");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_leistungsverzeichnisBaustelle_BaustelleID",
|
|
table: "leistungsverzeichnisBaustelle",
|
|
column: "BaustelleID");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_leistungsverzeichnisBaustelle_LeistungsverzeichnissID",
|
|
table: "leistungsverzeichnisBaustelle",
|
|
column: "LeistungsverzeichnissID");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "leistungsverzeichnisBaustelle");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Baustellen");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Leistungsverzeichnisses");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Kunden");
|
|
}
|
|
}
|
|
}
|