96 lines
3.5 KiB
C#
96 lines
3.5 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Brizco.Repository.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class editShift : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "ShiftDays",
|
|
schema: "public");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "IsRelatedToShift",
|
|
schema: "public",
|
|
table: "Tasks");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "EndAt",
|
|
schema: "public",
|
|
table: "ShiftPlans");
|
|
|
|
migrationBuilder.RenameColumn(
|
|
name: "StartAt",
|
|
schema: "public",
|
|
table: "ShiftPlans",
|
|
newName: "PlanDate");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.RenameColumn(
|
|
name: "PlanDate",
|
|
schema: "public",
|
|
table: "ShiftPlans",
|
|
newName: "StartAt");
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "IsRelatedToShift",
|
|
schema: "public",
|
|
table: "Tasks",
|
|
type: "boolean",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "EndAt",
|
|
schema: "public",
|
|
table: "ShiftPlans",
|
|
type: "timestamp without time zone",
|
|
nullable: false,
|
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "ShiftDays",
|
|
schema: "public",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
ShiftId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
|
CreatedBy = table.Column<string>(type: "text", nullable: false),
|
|
DayOfWeek = table.Column<int>(type: "integer", nullable: false),
|
|
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
|
|
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
|
ModifiedBy = table.Column<string>(type: "text", nullable: false),
|
|
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
|
RemovedBy = table.Column<string>(type: "text", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_ShiftDays", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_ShiftDays_Shifts_ShiftId",
|
|
column: x => x.ShiftId,
|
|
principalSchema: "public",
|
|
principalTable: "Shifts",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ShiftDays_ShiftId",
|
|
schema: "public",
|
|
table: "ShiftDays",
|
|
column: "ShiftId");
|
|
}
|
|
}
|
|
}
|