65 lines
2.7 KiB
C#
65 lines
2.7 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Brizco.Repository.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class addShiftPlanUser : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "ShiftPlanUsers",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
ShiftPlanId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
ApplicationUserId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
|
CreatedBy = table.Column<string>(type: "text", nullable: false),
|
|
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
|
|
RemovedBy = table.Column<string>(type: "text", nullable: false),
|
|
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
|
ModifiedBy = table.Column<string>(type: "text", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_ShiftPlanUsers", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_ShiftPlanUsers_AspNetUsers_ApplicationUserId",
|
|
column: x => x.ApplicationUserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
table.ForeignKey(
|
|
name: "FK_ShiftPlanUsers_ShiftPlans_ShiftPlanId",
|
|
column: x => x.ShiftPlanId,
|
|
principalTable: "ShiftPlans",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ShiftPlanUsers_ApplicationUserId",
|
|
table: "ShiftPlanUsers",
|
|
column: "ApplicationUserId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ShiftPlanUsers_ShiftPlanId",
|
|
table: "ShiftPlanUsers",
|
|
column: "ShiftPlanId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "ShiftPlanUsers");
|
|
}
|
|
}
|
|
}
|