using System; using Microsoft.EntityFrameworkCore.Migrations; 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(nullable: false) .Annotation("Sqlite:Autoincrement", true), GuidNr = table.Column(nullable: false), Kennzeichen = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_Fahrzeuge", x => x.ID); }); 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: "LeitungsverzeichnisPositionen", columns: table => new { ID = table.Column(nullable: false) .Annotation("Sqlite:Autoincrement", true), GuidNr = table.Column(nullable: false), Positionsnummer = table.Column(nullable: true), Beschreibung = table.Column(nullable: true), Einheit = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_LeitungsverzeichnisPositionen", x => x.ID); }); migrationBuilder.CreateTable( name: "Sanierungskonzept", columns: table => new { ID = table.Column(nullable: false) .Annotation("Sqlite:Autoincrement", true), GuidNr = table.Column(nullable: false), SanierungsTyp = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_Sanierungskonzept", x => x.ID); }); migrationBuilder.CreateTable( name: "SewerPoints", columns: table => new { ID = table.Column(nullable: false) .Annotation("Sqlite:Autoincrement", true), GuidNr = table.Column(nullable: false), Objektnummer = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_SewerPoints", x => x.ID); }); migrationBuilder.CreateTable( name: "Projekte", 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), Projektnummer = table.Column(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(nullable: false) .Annotation("Sqlite:Autoincrement", true), GuidNr = table.Column(nullable: false), SanierungskonzeptID = table.Column(nullable: true), FahrzeugID = table.Column(nullable: true), Mitarbeiter = table.Column(nullable: true), ZeitStempel = table.Column(nullable: false), Position = table.Column(nullable: false), LeitungsverzeichnisPositionID = table.Column(nullable: true), Anzahl = table.Column(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_LeitungsverzeichnisPositionID", 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(nullable: false) .Annotation("Sqlite:Autoincrement", true), GuidNr = table.Column(nullable: false), ProjektID = table.Column(nullable: true), OrtTeil = table.Column(nullable: true), BaustelleNummer = table.Column(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(nullable: false) .Annotation("Sqlite:Autoincrement", true), GuidNr = table.Column(nullable: false), BaustelleID = table.Column(nullable: true), StrasseName = table.Column(nullable: true), ObjektNummer = table.Column(nullable: true), SewerType = table.Column(nullable: false), PunktTypeOben = table.Column(nullable: false), PunktObenID = table.Column(nullable: true), PunktTypeUnten = table.Column(nullable: false), PunktUntenID = table.Column(nullable: true), DN = table.Column(nullable: false), Material = table.Column(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(nullable: false) .Annotation("Sqlite:Autoincrement", true), GuidNr = table.Column(nullable: false), SewerID = table.Column(nullable: true), SanierungsTyp = table.Column(nullable: false), SanierungskonzeptID = table.Column(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"); } } }