272 lines
13 KiB
C#
272 lines
13 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
namespace DaSaSo.EntityFramework.Migrations
|
|
{
|
|
public partial class Initial : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Clients",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
Firstname = table.Column<string>(type: "text", nullable: true),
|
|
LastName = table.Column<string>(type: "text", nullable: true),
|
|
Country = table.Column<string>(type: "text", nullable: true),
|
|
Street = table.Column<string>(type: "text", nullable: true),
|
|
Postcode = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Clients", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Impregnations",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
DN = table.Column<int>(type: "integer", nullable: false),
|
|
Number = table.Column<string>(type: "text", nullable: true),
|
|
Linerlength = table.Column<decimal>(type: "numeric", nullable: false),
|
|
IsAvaible = table.Column<bool>(type: "boolean", nullable: false),
|
|
Date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
LinerNumber = table.Column<string>(type: "text", nullable: true),
|
|
WallThickness = table.Column<decimal>(type: "numeric", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Impregnations", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "SewerPoints",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
Objektnummer = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_SewerPoints", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Projects",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
Name = table.Column<string>(type: "text", nullable: true),
|
|
Projektnummer = table.Column<string>(type: "text", nullable: true),
|
|
ClientId = table.Column<int>(type: "integer", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Projects", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Projects_Clients_ClientId",
|
|
column: x => x.ClientId,
|
|
principalTable: "Clients",
|
|
principalColumn: "Id");
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "PipeLiners",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
InversionPressure = table.Column<decimal>(type: "numeric", nullable: false),
|
|
ImpregnationId = table.Column<int>(type: "integer", nullable: true),
|
|
ClosedEnd = table.Column<bool>(type: "boolean", nullable: false),
|
|
Preliner = table.Column<bool>(type: "boolean", nullable: false),
|
|
TemperaturAssembly = table.Column<decimal>(type: "numeric", nullable: false),
|
|
TemperaturStorage = table.Column<decimal>(type: "numeric", nullable: false),
|
|
LinerLength = table.Column<decimal>(type: "numeric", nullable: false),
|
|
Operator = table.Column<string>(type: "text", nullable: true),
|
|
Date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
TemperatureOutdoors = table.Column<decimal>(type: "numeric", nullable: false),
|
|
TemperatureSewer = table.Column<decimal>(type: "numeric", nullable: false),
|
|
Weather = table.Column<string>(type: "text", nullable: true),
|
|
PreparationType = table.Column<int>(type: "integer", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_PipeLiners", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_PipeLiners_Impregnations_ImpregnationId",
|
|
column: x => x.ImpregnationId,
|
|
principalTable: "Impregnations",
|
|
principalColumn: "Id");
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Buildingsites",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
ProjectId = table.Column<int>(type: "integer", nullable: true),
|
|
BuildingSiteNumber = table.Column<string>(type: "text", nullable: true),
|
|
Country = table.Column<string>(type: "text", nullable: true),
|
|
ContactPerson = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Buildingsites", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Buildingsites_Projects_ProjectId",
|
|
column: x => x.ProjectId,
|
|
principalTable: "Projects",
|
|
principalColumn: "Id");
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "SewerObjects",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
BuildingSiteId = table.Column<int>(type: "integer", nullable: true),
|
|
SanNummer = table.Column<string>(type: "text", nullable: true),
|
|
StreetName = table.Column<string>(type: "text", nullable: true),
|
|
Hausnummer = table.Column<string>(type: "text", nullable: true),
|
|
ObjektName = table.Column<string>(type: "text", nullable: true),
|
|
PunktObenId = table.Column<int>(type: "integer", nullable: true),
|
|
PunktObenType = table.Column<int>(type: "integer", nullable: false),
|
|
PunktUntenId = table.Column<int>(type: "integer", nullable: true),
|
|
PunktUntenType = table.Column<int>(type: "integer", nullable: false),
|
|
Material = table.Column<string>(type: "text", nullable: true),
|
|
DN = table.Column<int>(type: "integer", nullable: false),
|
|
SewerLength = table.Column<decimal>(type: "numeric", nullable: false),
|
|
SewerActivated = table.Column<bool>(type: "boolean", nullable: false),
|
|
SewerCleaned = table.Column<bool>(type: "boolean", nullable: false),
|
|
WaterBarrier = table.Column<bool>(type: "boolean", nullable: false),
|
|
PermitNeeded = table.Column<bool>(type: "boolean", nullable: false),
|
|
BuildingsiteBarier = table.Column<bool>(type: "boolean", nullable: false),
|
|
PipeLinerId = table.Column<int>(type: "integer", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_SewerObjects", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_SewerObjects_Buildingsites_BuildingSiteId",
|
|
column: x => x.BuildingSiteId,
|
|
principalTable: "Buildingsites",
|
|
principalColumn: "Id");
|
|
table.ForeignKey(
|
|
name: "FK_SewerObjects_PipeLiners_PipeLinerId",
|
|
column: x => x.PipeLinerId,
|
|
principalTable: "PipeLiners",
|
|
principalColumn: "Id");
|
|
table.ForeignKey(
|
|
name: "FK_SewerObjects_SewerPoints_PunktObenId",
|
|
column: x => x.PunktObenId,
|
|
principalTable: "SewerPoints",
|
|
principalColumn: "Id");
|
|
table.ForeignKey(
|
|
name: "FK_SewerObjects_SewerPoints_PunktUntenId",
|
|
column: x => x.PunktUntenId,
|
|
principalTable: "SewerPoints",
|
|
principalColumn: "Id");
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "SewerDamages",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
SewerObjectId = table.Column<int>(type: "integer", nullable: true),
|
|
Distance = table.Column<decimal>(type: "numeric", nullable: false),
|
|
DamageType = table.Column<int>(type: "integer", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_SewerDamages", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_SewerDamages_SewerObjects_SewerObjectId",
|
|
column: x => x.SewerObjectId,
|
|
principalTable: "SewerObjects",
|
|
principalColumn: "Id");
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Buildingsites_ProjectId",
|
|
table: "Buildingsites",
|
|
column: "ProjectId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_PipeLiners_ImpregnationId",
|
|
table: "PipeLiners",
|
|
column: "ImpregnationId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Projects_ClientId",
|
|
table: "Projects",
|
|
column: "ClientId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_SewerDamages_SewerObjectId",
|
|
table: "SewerDamages",
|
|
column: "SewerObjectId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_SewerObjects_BuildingSiteId",
|
|
table: "SewerObjects",
|
|
column: "BuildingSiteId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_SewerObjects_PipeLinerId",
|
|
table: "SewerObjects",
|
|
column: "PipeLinerId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_SewerObjects_PunktObenId",
|
|
table: "SewerObjects",
|
|
column: "PunktObenId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_SewerObjects_PunktUntenId",
|
|
table: "SewerObjects",
|
|
column: "PunktUntenId");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "SewerDamages");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "SewerObjects");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Buildingsites");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "PipeLiners");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "SewerPoints");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Projects");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Impregnations");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Clients");
|
|
}
|
|
}
|
|
}
|