using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace PARR.DAL.Migrations { /// public partial class tblUnitInUnits : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "UnitInUnits", schema: "unit", columns: table => new { ParentUnitId = table.Column(type: "uuid", nullable: false), ChildUnitId = table.Column(type: "uuid", nullable: false), DateCreated = table.Column(type: "timestamp with time zone", nullable: false), DateSynced = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_UnitInUnits", x => new { x.ParentUnitId, x.ChildUnitId }); table.ForeignKey( name: "FK_UnitInUnits_Units_ChildUnitId", column: x => x.ChildUnitId, principalSchema: "unit", principalTable: "Units", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_UnitInUnits_Units_ParentUnitId", column: x => x.ParentUnitId, principalSchema: "unit", principalTable: "Units", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }, comment: "Таблица связей иерархии между ЭК"); migrationBuilder.CreateIndex( name: "IX_UnitInUnits_ChildUnitId", schema: "unit", table: "UnitInUnits", column: "ChildUnitId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "UnitInUnits", schema: "unit"); } } }