67 lines
2.5 KiB
C#
67 lines
2.5 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: "Baustellen",
|
|
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),
|
|
Strasse = table.Column<string>(nullable: true),
|
|
Projektnummer = table.Column<string>(nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Baustellen", x => x.ID);
|
|
table.ForeignKey(
|
|
name: "FK_Baustellen_Kunden_KundeID",
|
|
column: x => x.KundeID,
|
|
principalTable: "Kunden",
|
|
principalColumn: "ID",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Baustellen_KundeID",
|
|
table: "Baustellen",
|
|
column: "KundeID");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Baustellen");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Kunden");
|
|
}
|
|
}
|
|
}
|