114 lines
4.2 KiB
C#
114 lines
4.2 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Marco.Pms.DataAccess.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class EmployeeRolesMapping : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "EmployeeRoleMappings",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
EmployeeId = table.Column<int>(type: "int", nullable: false),
|
|
RoleId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
TenantId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_EmployeeRoleMappings", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_EmployeeRoleMappings_ApplicationRoles_RoleId",
|
|
column: x => x.RoleId,
|
|
principalTable: "ApplicationRoles",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_EmployeeRoleMappings_Employees_EmployeeId",
|
|
column: x => x.EmployeeId,
|
|
principalTable: "Employees",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_EmployeeRoleMappings_Tenants_TenantId",
|
|
column: x => x.TenantId,
|
|
principalTable: "Tenants",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "Modules",
|
|
keyColumn: "Id",
|
|
keyValue: 1,
|
|
column: "Key",
|
|
value: "05db8d60-e977-40f6-b944-8602d0d4cb98");
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "Modules",
|
|
keyColumn: "Id",
|
|
keyValue: 2,
|
|
column: "Key",
|
|
value: "456ddbbe-0963-406d-8874-589a546c3670");
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "Modules",
|
|
keyColumn: "Id",
|
|
keyValue: 3,
|
|
column: "Key",
|
|
value: "19eca67f-c3b1-4e5c-8d95-c8341cf058ae");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_EmployeeRoleMappings_EmployeeId",
|
|
table: "EmployeeRoleMappings",
|
|
column: "EmployeeId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_EmployeeRoleMappings_RoleId",
|
|
table: "EmployeeRoleMappings",
|
|
column: "RoleId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_EmployeeRoleMappings_TenantId",
|
|
table: "EmployeeRoleMappings",
|
|
column: "TenantId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "EmployeeRoleMappings");
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "Modules",
|
|
keyColumn: "Id",
|
|
keyValue: 1,
|
|
column: "Key",
|
|
value: "286516c2-0d55-439c-a8fa-b6858735ef65");
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "Modules",
|
|
keyColumn: "Id",
|
|
keyValue: 2,
|
|
column: "Key",
|
|
value: "6a84b9c0-1478-4d87-9ef6-34c00f0fca4a");
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "Modules",
|
|
keyColumn: "Id",
|
|
keyValue: 3,
|
|
column: "Key",
|
|
value: "c38971e1-491e-479f-9d02-54634c0b4908");
|
|
}
|
|
}
|
|
}
|