using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace KanSan.Base.Migrations { public partial class Güteschutzverlinkungen : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_KurzlinerSanierung_Schaeden_SchadPositionID", table: "KurzlinerSanierung"); migrationBuilder.DropTable( name: "HutprofilSanierung"); migrationBuilder.DropPrimaryKey( name: "PK_KurzlinerSanierung", table: "KurzlinerSanierung"); migrationBuilder.RenameTable( name: "KurzlinerSanierung", newName: "GueteschutzProtokoll"); migrationBuilder.RenameIndex( name: "IX_KurzlinerSanierung_SchadPositionID", table: "GueteschutzProtokoll", newName: "IX_GueteschutzProtokoll_SchadPositionID"); migrationBuilder.AddColumn( name: "GueteschutzProtokolID", table: "Taetigkeiten", nullable: true); migrationBuilder.AlterColumn( name: "PackerDruckEnde", table: "GueteschutzProtokoll", nullable: true, oldClrType: typeof(double), oldType: "double precision"); migrationBuilder.AlterColumn( name: "PackerDruckAnfang", table: "GueteschutzProtokoll", nullable: true, oldClrType: typeof(double), oldType: "double precision"); migrationBuilder.AlterColumn( name: "MischZeit", table: "GueteschutzProtokoll", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "Lang", table: "GueteschutzProtokoll", nullable: true, oldClrType: typeof(double), oldType: "double precision"); migrationBuilder.AlterColumn( name: "Flaechengewicht", table: "GueteschutzProtokoll", nullable: true, oldClrType: typeof(int), oldType: "integer"); migrationBuilder.AlterColumn( name: "FixierungAufPacker", table: "GueteschutzProtokoll", nullable: true, oldClrType: typeof(bool), oldType: "boolean"); migrationBuilder.AlterColumn( name: "EntlueftenPacker", table: "GueteschutzProtokoll", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AlterColumn( name: "Breit", table: "GueteschutzProtokoll", nullable: true, oldClrType: typeof(double), oldType: "double precision"); migrationBuilder.AlterColumn( name: "Auffaelligkeit", table: "GueteschutzProtokoll", nullable: true, oldClrType: typeof(bool), oldType: "boolean"); migrationBuilder.AlterColumn( name: "AnpressenPacker", table: "GueteschutzProtokoll", nullable: true, oldClrType: typeof(DateTime), oldType: "timestamp without time zone"); migrationBuilder.AddColumn( name: "Discriminator", table: "GueteschutzProtokoll", nullable: false, defaultValue: ""); migrationBuilder.AddColumn( name: "InnenBeschichtung", table: "GueteschutzProtokoll", nullable: true); migrationBuilder.AddColumn( name: "RohrDN", table: "GueteschutzProtokoll", nullable: true); migrationBuilder.AddColumn( name: "SeitenKanalDruckAnfang", table: "GueteschutzProtokoll", nullable: true); migrationBuilder.AddColumn( name: "SeitenKanalDruckEnde", table: "GueteschutzProtokoll", nullable: true); migrationBuilder.AddColumn( name: "Winkel", table: "GueteschutzProtokoll", nullable: true); migrationBuilder.AddPrimaryKey( name: "PK_GueteschutzProtokoll", table: "GueteschutzProtokoll", column: "ID"); migrationBuilder.CreateIndex( name: "IX_Taetigkeiten_GueteschutzProtokolID", table: "Taetigkeiten", column: "GueteschutzProtokolID"); migrationBuilder.AddForeignKey( name: "FK_GueteschutzProtokoll_Schaeden_SchadPositionID", table: "GueteschutzProtokoll", column: "SchadPositionID", principalTable: "Schaeden", principalColumn: "ID", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "FK_Taetigkeiten_GueteschutzProtokoll_GueteschutzProtokolID", table: "Taetigkeiten", column: "GueteschutzProtokolID", principalTable: "GueteschutzProtokoll", principalColumn: "ID", onDelete: ReferentialAction.Restrict); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_GueteschutzProtokoll_Schaeden_SchadPositionID", table: "GueteschutzProtokoll"); migrationBuilder.DropForeignKey( name: "FK_Taetigkeiten_GueteschutzProtokoll_GueteschutzProtokolID", table: "Taetigkeiten"); migrationBuilder.DropIndex( name: "IX_Taetigkeiten_GueteschutzProtokolID", table: "Taetigkeiten"); migrationBuilder.DropPrimaryKey( name: "PK_GueteschutzProtokoll", table: "GueteschutzProtokoll"); migrationBuilder.DropColumn( name: "GueteschutzProtokolID", table: "Taetigkeiten"); migrationBuilder.DropColumn( name: "Discriminator", table: "GueteschutzProtokoll"); migrationBuilder.DropColumn( name: "InnenBeschichtung", table: "GueteschutzProtokoll"); migrationBuilder.DropColumn( name: "RohrDN", table: "GueteschutzProtokoll"); migrationBuilder.DropColumn( name: "SeitenKanalDruckAnfang", table: "GueteschutzProtokoll"); migrationBuilder.DropColumn( name: "SeitenKanalDruckEnde", table: "GueteschutzProtokoll"); migrationBuilder.DropColumn( name: "Winkel", table: "GueteschutzProtokoll"); migrationBuilder.RenameTable( name: "GueteschutzProtokoll", newName: "KurzlinerSanierung"); migrationBuilder.RenameIndex( name: "IX_GueteschutzProtokoll_SchadPositionID", table: "KurzlinerSanierung", newName: "IX_KurzlinerSanierung_SchadPositionID"); migrationBuilder.AlterColumn( name: "Lang", table: "KurzlinerSanierung", type: "double precision", nullable: false, oldClrType: typeof(double), oldNullable: true); migrationBuilder.AlterColumn( name: "Breit", table: "KurzlinerSanierung", type: "double precision", nullable: false, oldClrType: typeof(double), oldNullable: true); migrationBuilder.AlterColumn( name: "PackerDruckEnde", table: "KurzlinerSanierung", type: "double precision", nullable: false, oldClrType: typeof(double), oldNullable: true); migrationBuilder.AlterColumn( name: "PackerDruckAnfang", table: "KurzlinerSanierung", type: "double precision", nullable: false, oldClrType: typeof(double), oldNullable: true); migrationBuilder.AlterColumn( name: "MischZeit", table: "KurzlinerSanierung", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldNullable: true); migrationBuilder.AlterColumn( name: "Flaechengewicht", table: "KurzlinerSanierung", type: "integer", nullable: false, oldClrType: typeof(int), oldNullable: true); migrationBuilder.AlterColumn( name: "FixierungAufPacker", table: "KurzlinerSanierung", type: "boolean", nullable: false, oldClrType: typeof(bool), oldNullable: true); migrationBuilder.AlterColumn( name: "EntlueftenPacker", table: "KurzlinerSanierung", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldNullable: true); migrationBuilder.AlterColumn( name: "Auffaelligkeit", table: "KurzlinerSanierung", type: "boolean", nullable: false, oldClrType: typeof(bool), oldNullable: true); migrationBuilder.AlterColumn( name: "AnpressenPacker", table: "KurzlinerSanierung", type: "timestamp without time zone", nullable: false, oldClrType: typeof(DateTime), oldNullable: true); migrationBuilder.AddPrimaryKey( name: "PK_KurzlinerSanierung", table: "KurzlinerSanierung", column: "ID"); migrationBuilder.CreateTable( name: "HutprofilSanierung", columns: table => new { ID = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), AnpressenPacker = table.Column(type: "timestamp without time zone", nullable: false), Auffaelligkeit = table.Column(type: "boolean", nullable: false), AussenTemp = table.Column(type: "integer", nullable: false), Bericht = table.Column(type: "boolean", nullable: false), Dichtheit = table.Column(type: "boolean", nullable: false), EntlueftenPacker = table.Column(type: "timestamp without time zone", nullable: false), Film = table.Column(type: "boolean", nullable: false), FixierungAufPacker = table.Column(type: "boolean", nullable: false), Flaechengewicht = table.Column(type: "integer", nullable: false), GuidNr = table.Column(type: "uuid", nullable: false), HarzMaterialArt = table.Column(type: "text", nullable: true), HarzmaterialHersteller = table.Column(type: "text", nullable: true), InnenBeschichtung = table.Column(type: "boolean", nullable: false), KanalTemp = table.Column(type: "integer", nullable: false), KompACharge = table.Column(type: "text", nullable: true), KompBCharge = table.Column(type: "text", nullable: true), MischZeit = table.Column(type: "timestamp without time zone", nullable: false), PackerDruckAnfang = table.Column(type: "double precision", nullable: false), PackerDruckEnde = table.Column(type: "double precision", nullable: false), RohrDN = table.Column(type: "text", nullable: true), SchadPositionID = table.Column(type: "integer", nullable: true), SeitenKanalDruckAnfang = table.Column(type: "double precision", nullable: false), SeitenKanalDruckEnde = table.Column(type: "double precision", nullable: false), Sichtkontrolle = table.Column(type: "boolean", nullable: false), TraegerCharge = table.Column(type: "text", nullable: true), TraegerHersteller = table.Column(type: "text", nullable: true), TraegerKurzliner = table.Column(type: "text", nullable: true), Video = table.Column(type: "boolean", nullable: false), Wetter = table.Column(type: "integer", nullable: false), Winkel = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_HutprofilSanierung", x => x.ID); table.ForeignKey( name: "FK_HutprofilSanierung_Schaeden_SchadPositionID", column: x => x.SchadPositionID, principalTable: "Schaeden", principalColumn: "ID", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_HutprofilSanierung_SchadPositionID", table: "HutprofilSanierung", column: "SchadPositionID"); migrationBuilder.AddForeignKey( name: "FK_KurzlinerSanierung_Schaeden_SchadPositionID", table: "KurzlinerSanierung", column: "SchadPositionID", principalTable: "Schaeden", principalColumn: "ID", onDelete: ReferentialAction.Restrict); } } }