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(nullable: false) .Annotation("Sqlite:Autoincrement", true), GuidNr = table.Column(nullable: false), Vorname = table.Column(nullable: true), Nachname = table.Column(nullable: true), Strasse = table.Column(nullable: true), PLZ = table.Column(nullable: true), Ort = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_Kunden", x => x.ID); }); migrationBuilder.CreateTable( name: "Baustellen", columns: table => new { ID = table.Column(nullable: false) .Annotation("Sqlite:Autoincrement", true), GuidNr = table.Column(nullable: false), KundeID = table.Column(nullable: true), Ort = table.Column(nullable: true), Strasse = table.Column(nullable: true), Projektnummer = table.Column(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"); } } }