using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace SewerStammGen.EntityFramework.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("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Name = table.Column(type: "text", nullable: false), Strasse = table.Column(type: "text", nullable: false), Ort = table.Column(type: "text", nullable: false), Postleitzahl = table.Column(type: "text", nullable: false), Ansprechpartner = table.Column(type: "text", nullable: false), Telefonnummer = table.Column(type: "text", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Auftraggebers", x => x.Id); }); migrationBuilder.CreateTable( name: "Projekte", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Projektname = table.Column(type: "text", nullable: false), Erstelldatum = table.Column(type: "text", nullable: false), Strasse = table.Column(type: "text", nullable: false), Ort = table.Column(type: "text", nullable: false), ExportType = table.Column(type: "integer", nullable: false), Kodierungssystem = table.Column(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Projekte", x => x.Id); }); migrationBuilder.CreateTable( name: "Schaechte", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Objektbezeichnung = table.Column(type: "text", nullable: false), RechtsWert = table.Column(type: "numeric(18,4)", nullable: false), HochWert = table.Column(type: "numeric(18,4)", nullable: false), SohlHoehe = table.Column(type: "numeric(18,4)", nullable: false), DeckelHoehe = table.Column(type: "numeric(18,4)", nullable: false), Entwaesserung = table.Column(type: "integer", nullable: false), ProjektId = table.Column(type: "integer", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Schaechte", x => x.Id); table.ForeignKey( name: "FK_Schaechte_Projekte_ProjektId", column: x => x.ProjektId, principalTable: "Projekte", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "Kanaele", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Objektbezeichnung = table.Column(type: "text", nullable: false), StartSchachtId = table.Column(type: "integer", nullable: true), EndSchachtId = table.Column(type: "integer", nullable: true), DN = table.Column(type: "integer", nullable: false), Material = table.Column(type: "text", nullable: false), Haltungslaenge = table.Column(type: "numeric", nullable: false), Entwaesserung = table.Column(type: "integer", nullable: false), ProjektId = table.Column(type: "integer", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Kanaele", x => x.Id); table.ForeignKey( name: "FK_Kanaele_Projekte_ProjektId", column: x => x.ProjektId, principalTable: "Projekte", principalColumn: "Id"); table.ForeignKey( name: "FK_Kanaele_Schaechte_EndSchachtId", column: x => x.EndSchachtId, principalTable: "Schaechte", principalColumn: "Id"); table.ForeignKey( name: "FK_Kanaele_Schaechte_StartSchachtId", column: x => x.StartSchachtId, principalTable: "Schaechte", principalColumn: "Id"); }); migrationBuilder.CreateIndex( name: "IX_Kanaele_EndSchachtId", table: "Kanaele", column: "EndSchachtId"); migrationBuilder.CreateIndex( name: "IX_Kanaele_ProjektId", table: "Kanaele", column: "ProjektId"); migrationBuilder.CreateIndex( name: "IX_Kanaele_StartSchachtId", table: "Kanaele", column: "StartSchachtId"); migrationBuilder.CreateIndex( name: "IX_Schaechte_ProjektId", table: "Schaechte", column: "ProjektId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Auftraggebers"); migrationBuilder.DropTable( name: "Kanaele"); migrationBuilder.DropTable( name: "Schaechte"); migrationBuilder.DropTable( name: "Projekte"); } } }