using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace KanSan.Base.Migrations { public partial class LeistungsverzeichnisReferenz : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "LeistungsverzeichnisBaustellen", columns: table => new { ID = table.Column(nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), GuidNr = table.Column(nullable: false), BaustelleID = table.Column(nullable: true), LVPositionID = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_LeistungsverzeichnisBaustellen", x => x.ID); table.ForeignKey( name: "FK_LeistungsverzeichnisBaustellen_Baustelle_BaustelleID", column: x => x.BaustelleID, principalTable: "Baustelle", principalColumn: "ID", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_LeistungsverzeichnisBaustellen_LeistungsverzeichnisPosition~", column: x => x.LVPositionID, principalTable: "LeistungsverzeichnisPositionen", principalColumn: "ID", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_LeistungsverzeichnisBaustellen_BaustelleID", table: "LeistungsverzeichnisBaustellen", column: "BaustelleID"); migrationBuilder.CreateIndex( name: "IX_LeistungsverzeichnisBaustellen_LVPositionID", table: "LeistungsverzeichnisBaustellen", column: "LVPositionID"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "LeistungsverzeichnisBaustellen"); } } }