feat(dal): Добавлена таблица WorkGroups и AppInWorkGroups
This commit is contained in:
97
PARR.DAL/Migrations/20240603051427_TblAddWorkGroup.cs
Normal file
97
PARR.DAL/Migrations/20240603051427_TblAddWorkGroup.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class TblAddWorkGroup : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "WorkGroupId",
|
||||
table: "Hosts",
|
||||
type: "uuid",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WorkGroups",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WorkGroups", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AppInWorkInWorkGroups",
|
||||
columns: table => new
|
||||
{
|
||||
ApplicationsInWorkId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
WorkGroupId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AppInWorkInWorkGroups", x => new { x.ApplicationsInWorkId, x.WorkGroupId });
|
||||
table.ForeignKey(
|
||||
name: "FK_AppInWorkInWorkGroups_ApplicationsInWorks_ApplicationsInWor~",
|
||||
column: x => x.ApplicationsInWorkId,
|
||||
principalTable: "ApplicationsInWorks",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppInWorkInWorkGroups_WorkGroups_WorkGroupId",
|
||||
column: x => x.WorkGroupId,
|
||||
principalTable: "WorkGroups",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Hosts_WorkGroupId",
|
||||
table: "Hosts",
|
||||
column: "WorkGroupId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppInWorkInWorkGroups_WorkGroupId",
|
||||
table: "AppInWorkInWorkGroups",
|
||||
column: "WorkGroupId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Hosts_WorkGroups_WorkGroupId",
|
||||
table: "Hosts",
|
||||
column: "WorkGroupId",
|
||||
principalTable: "WorkGroups",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Hosts_WorkGroups_WorkGroupId",
|
||||
table: "Hosts");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AppInWorkInWorkGroups");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WorkGroups");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Hosts_WorkGroupId",
|
||||
table: "Hosts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "WorkGroupId",
|
||||
table: "Hosts");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user