212 lines
9.2 KiB
C#
212 lines
9.2 KiB
C#
using System;
|
||
using Microsoft.EntityFrameworkCore.Migrations;
|
||
|
||
#nullable disable
|
||
|
||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||
|
||
namespace PARR.DAL.Migrations
|
||
{
|
||
/// <inheritdoc />
|
||
public partial class tblScheduleExludes : Migration
|
||
{
|
||
/// <inheritdoc />
|
||
protected override void Up(MigrationBuilder migrationBuilder)
|
||
{
|
||
migrationBuilder.DeleteData(
|
||
table: "Settings",
|
||
keyColumn: "Name",
|
||
keyValue: "ScheduleExcludeCalendar");
|
||
|
||
migrationBuilder.DeleteData(
|
||
table: "Settings",
|
||
keyColumn: "Name",
|
||
keyValue: "ScheduleExcludeType");
|
||
|
||
migrationBuilder.EnsureSchema(
|
||
name: "schedule");
|
||
|
||
migrationBuilder.AddColumn<Guid>(
|
||
name: "ScheduleExcludeTypeCalendarId",
|
||
schema: "job",
|
||
table: "Groups",
|
||
type: "uuid",
|
||
nullable: true);
|
||
|
||
migrationBuilder.AddColumn<Guid>(
|
||
name: "ScheduleExcludeTypeId",
|
||
schema: "job",
|
||
table: "Groups",
|
||
type: "uuid",
|
||
nullable: false,
|
||
defaultValue: new Guid("0595B8E0-F322-4661-B5E3-064AF8FBE7CD"));
|
||
|
||
migrationBuilder.AddColumn<bool>(
|
||
name: "IsInverse",
|
||
schema: "job",
|
||
table: "FieldFilters",
|
||
type: "boolean",
|
||
nullable: false,
|
||
defaultValue: false);
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "ExcludeTypeCalendars",
|
||
schema: "schedule",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||
Title = table.Column<string>(type: "text", nullable: false),
|
||
EsppName = table.Column<string>(type: "text", nullable: false),
|
||
EsppValue = table.Column<string>(type: "text", nullable: false),
|
||
Code = table.Column<string>(type: "text", nullable: false)
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_ExcludeTypeCalendars", x => x.Id);
|
||
},
|
||
comment: "Расписание регламентной работы, исключение - Календарь");
|
||
|
||
migrationBuilder.CreateTable(
|
||
name: "ExcludeTypes",
|
||
schema: "schedule",
|
||
columns: table => new
|
||
{
|
||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||
Title = table.Column<string>(type: "text", nullable: false),
|
||
EsppName = table.Column<string>(type: "text", nullable: false),
|
||
EsppValue = table.Column<string>(type: "text", nullable: false),
|
||
Code = table.Column<string>(type: "text", nullable: false)
|
||
},
|
||
constraints: table =>
|
||
{
|
||
table.PrimaryKey("PK_ExcludeTypes", x => x.Id);
|
||
},
|
||
comment: "Расписание регламентной работы - Тип исключения");
|
||
|
||
migrationBuilder.InsertData(
|
||
schema: "schedule",
|
||
table: "ExcludeTypeCalendars",
|
||
columns: new[] { "Id", "Code", "DateCreated", "EsppName", "EsppValue", "Title" },
|
||
values: new object[,]
|
||
{
|
||
{ new Guid("6834f1d5-ac51-43d5-974e-4c759d7bbf9f"), "24x7", new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), "24x7", "24x7", "24x7" },
|
||
{ new Guid("a26edb88-0267-4fbf-b7ec-d172b0a86c9c"), "24x5", new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), "24x5", "24x5", "24x5" }
|
||
});
|
||
|
||
migrationBuilder.InsertData(
|
||
schema: "schedule",
|
||
table: "ExcludeTypes",
|
||
columns: new[] { "Id", "Code", "DateCreated", "EsppName", "EsppValue", "Title" },
|
||
values: new object[,]
|
||
{
|
||
{ new Guid("0595b8e0-f322-4661-b5e3-064af8fbe7cd"), "None", new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), "Нет исключений", "NONE", "Нет исключений" },
|
||
{ new Guid("2b7a4356-9aaf-4e00-b444-42f0b5010e25"), "Only", new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), "Выполнить ТОЛЬКО В указанном календаре", "ONLY", "Выполнить ТОЛЬКО В указанном календаре" },
|
||
{ new Guid("38cd9e64-27c1-4672-a805-2211952a48bd"), "Except", new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), "Выполнить везде, КРОМЕ указанного календаря", "EXCEPT", "Выполнить везде, КРОМЕ указанного календаря" }
|
||
});
|
||
|
||
migrationBuilder.UpdateData(
|
||
table: "Settings",
|
||
keyColumn: "Name",
|
||
keyValue: "EsppUnitTag",
|
||
column: "Value",
|
||
value: "ПАРР_");
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_Groups_ScheduleExcludeTypeCalendarId",
|
||
schema: "job",
|
||
table: "Groups",
|
||
column: "ScheduleExcludeTypeCalendarId");
|
||
|
||
migrationBuilder.CreateIndex(
|
||
name: "IX_Groups_ScheduleExcludeTypeId",
|
||
schema: "job",
|
||
table: "Groups",
|
||
column: "ScheduleExcludeTypeId");
|
||
|
||
migrationBuilder.AddForeignKey(
|
||
name: "FK_Groups_ExcludeTypeCalendars_ScheduleExcludeTypeCalendarId",
|
||
schema: "job",
|
||
table: "Groups",
|
||
column: "ScheduleExcludeTypeCalendarId",
|
||
principalSchema: "schedule",
|
||
principalTable: "ExcludeTypeCalendars",
|
||
principalColumn: "Id");
|
||
|
||
migrationBuilder.AddForeignKey(
|
||
name: "FK_Groups_ExcludeTypes_ScheduleExcludeTypeId",
|
||
schema: "job",
|
||
table: "Groups",
|
||
column: "ScheduleExcludeTypeId",
|
||
principalSchema: "schedule",
|
||
principalTable: "ExcludeTypes",
|
||
principalColumn: "Id",
|
||
onDelete: ReferentialAction.Cascade);
|
||
}
|
||
|
||
/// <inheritdoc />
|
||
protected override void Down(MigrationBuilder migrationBuilder)
|
||
{
|
||
migrationBuilder.DropForeignKey(
|
||
name: "FK_Groups_ExcludeTypeCalendars_ScheduleExcludeTypeCalendarId",
|
||
schema: "job",
|
||
table: "Groups");
|
||
|
||
migrationBuilder.DropForeignKey(
|
||
name: "FK_Groups_ExcludeTypes_ScheduleExcludeTypeId",
|
||
schema: "job",
|
||
table: "Groups");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "ExcludeTypeCalendars",
|
||
schema: "schedule");
|
||
|
||
migrationBuilder.DropTable(
|
||
name: "ExcludeTypes",
|
||
schema: "schedule");
|
||
|
||
migrationBuilder.DropIndex(
|
||
name: "IX_Groups_ScheduleExcludeTypeCalendarId",
|
||
schema: "job",
|
||
table: "Groups");
|
||
|
||
migrationBuilder.DropIndex(
|
||
name: "IX_Groups_ScheduleExcludeTypeId",
|
||
schema: "job",
|
||
table: "Groups");
|
||
|
||
migrationBuilder.DropColumn(
|
||
name: "ScheduleExcludeTypeCalendarId",
|
||
schema: "job",
|
||
table: "Groups");
|
||
|
||
migrationBuilder.DropColumn(
|
||
name: "ScheduleExcludeTypeId",
|
||
schema: "job",
|
||
table: "Groups");
|
||
|
||
migrationBuilder.DropColumn(
|
||
name: "IsInverse",
|
||
schema: "job",
|
||
table: "FieldFilters");
|
||
|
||
migrationBuilder.UpdateData(
|
||
table: "Settings",
|
||
keyColumn: "Name",
|
||
keyValue: "EsppUnitTag",
|
||
column: "Value",
|
||
value: "ПАРР-");
|
||
|
||
migrationBuilder.InsertData(
|
||
table: "Settings",
|
||
columns: new[] { "Name", "Description", "Value" },
|
||
values: new object[,]
|
||
{
|
||
{ "ScheduleExcludeCalendar", "Расписание регламентной работы - Календарь", "8x5 (8.00-17.00)" },
|
||
{ "ScheduleExcludeType", "Расписание регламентной работы - Тип исключения", "Выполнить ТОЛЬКО В указанном календаре" }
|
||
});
|
||
}
|
||
}
|
||
}
|