using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace KanSan.Base.Migrations { public partial class LeistungsverzeichnisUpdate : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Taetigkeiten_LeitungsverzeichnisPositionen_Leitungsverzeich~", table: "Taetigkeiten"); migrationBuilder.DropTable( name: "LeitungsverzeichnisPositionen"); migrationBuilder.CreateTable( name: "LeistungsverzeichnisPositionen", columns: table => new { ID = table.Column(nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), 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_LeistungsverzeichnisPositionen", x => x.ID); }); migrationBuilder.AddForeignKey( name: "FK_Taetigkeiten_LeistungsverzeichnisPositionen_Leitungsverzeic~", table: "Taetigkeiten", column: "LeitungsverzeichnisPositionID", principalTable: "LeistungsverzeichnisPositionen", principalColumn: "ID", onDelete: ReferentialAction.Restrict); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Taetigkeiten_LeistungsverzeichnisPositionen_Leitungsverzeic~", table: "Taetigkeiten"); migrationBuilder.DropTable( name: "LeistungsverzeichnisPositionen"); migrationBuilder.CreateTable( name: "LeitungsverzeichnisPositionen", columns: table => new { ID = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Beschreibung = table.Column(type: "text", nullable: true), Einheit = table.Column(type: "text", nullable: true), GuidNr = table.Column(type: "uuid", nullable: false), Positionsnummer = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_LeitungsverzeichnisPositionen", x => x.ID); }); migrationBuilder.AddForeignKey( name: "FK_Taetigkeiten_LeitungsverzeichnisPositionen_Leitungsverzeich~", table: "Taetigkeiten", column: "LeitungsverzeichnisPositionID", principalTable: "LeitungsverzeichnisPositionen", principalColumn: "ID", onDelete: ReferentialAction.Restrict); } } }