using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace SanSystem.Migrations { public partial class InitialCreate : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Auftraggebers", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Name = table.Column(type: "TEXT", nullable: true), Strasse = table.Column(type: "TEXT", nullable: true), Ort = table.Column(type: "TEXT", nullable: true), Ansprechpartner = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Auftraggebers", x => x.Id); }); migrationBuilder.CreateTable( name: "Projekte", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Nummer = table.Column(type: "TEXT", nullable: true), Ort = table.Column(type: "TEXT", nullable: true), AuftraggeberId = table.Column(type: "INTEGER", nullable: true), SanierungsIDPrefix = table.Column(type: "TEXT", nullable: true), SanierungsIDSuffix = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Projekte", x => x.Id); table.ForeignKey( name: "FK_Projekte_Auftraggebers_AuftraggeberId", column: x => x.AuftraggeberId, principalTable: "Auftraggebers", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "InspektionObjekte", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), OverrideAuftraggeberId = table.Column(type: "INTEGER", nullable: true), GeschlossenesEnde = table.Column(type: "INTEGER", nullable: false), StrasseName = table.Column(type: "TEXT", nullable: true), OrtName = table.Column(type: "TEXT", nullable: true), Hausnummer = table.Column(type: "TEXT", nullable: true), Projektnummer = table.Column(type: "TEXT", nullable: true), Objektbezeichnung = table.Column(type: "TEXT", nullable: true), VonPunkt = table.Column(type: "TEXT", nullable: true), BisPunkt = table.Column(type: "TEXT", nullable: true), RohrMaterial = table.Column(type: "TEXT", nullable: true), Kanalrohrweite = table.Column(type: "INTEGER", nullable: false), Haltungslaenge = table.Column(type: "REAL", nullable: false), Schachtlaenge = table.Column(type: "REAL", nullable: false), HaltungGemessen = table.Column(type: "TEXT", nullable: false), Bemerkung = table.Column(type: "TEXT", nullable: true), Inspektionsrichtung = table.Column(type: "TEXT", nullable: true), Sanierungsnummer = table.Column(type: "TEXT", nullable: true), Guid = table.Column(type: "TEXT", nullable: false), ProjektId = table.Column(type: "INTEGER", nullable: true) }, constraints: table => { table.PrimaryKey("PK_InspektionObjekte", x => x.Id); table.ForeignKey( name: "FK_InspektionObjekte_Auftraggebers_OverrideAuftraggeberId", column: x => x.OverrideAuftraggeberId, principalTable: "Auftraggebers", principalColumn: "Id"); table.ForeignKey( name: "FK_InspektionObjekte_Projekte_ProjektId", column: x => x.ProjektId, principalTable: "Projekte", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "Sanierung", columns: table => new { Guid = table.Column(type: "TEXT", nullable: false), TempAusen = table.Column(type: "REAL", nullable: false), TempKanal = table.Column(type: "REAL", nullable: false), Wetter = table.Column(type: "TEXT", nullable: true), GenehmigungVorhanden = table.Column(type: "INTEGER", nullable: false), WasserhaltungEingerichtet = table.Column(type: "INTEGER", nullable: false), STVOAbsicherung = table.Column(type: "INTEGER", nullable: false), HDReinigung = table.Column(type: "INTEGER", nullable: false), HDReinigungDatum = table.Column(type: "TEXT", nullable: false), InspektionsobjektId = table.Column(type: "INTEGER", nullable: true), VorbereitetMechanisch = table.Column(type: "INTEGER", nullable: false), VorbereitetRoboter = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.ForeignKey( name: "FK_Sanierung_InspektionObjekte_InspektionsobjektId", column: x => x.InspektionsobjektId, principalTable: "InspektionObjekte", principalColumn: "Id"); }); migrationBuilder.CreateIndex( name: "IX_InspektionObjekte_OverrideAuftraggeberId", table: "InspektionObjekte", column: "OverrideAuftraggeberId"); migrationBuilder.CreateIndex( name: "IX_InspektionObjekte_ProjektId", table: "InspektionObjekte", column: "ProjektId"); migrationBuilder.CreateIndex( name: "IX_Projekte_AuftraggeberId", table: "Projekte", column: "AuftraggeberId"); migrationBuilder.CreateIndex( name: "IX_Sanierung_InspektionsobjektId", table: "Sanierung", column: "InspektionsobjektId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Sanierung"); migrationBuilder.DropTable( name: "InspektionObjekte"); migrationBuilder.DropTable( name: "Projekte"); migrationBuilder.DropTable( name: "Auftraggebers"); } } }