using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Brizco.Repository.Migrations
{
///
public partial class AddPositionPermission : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "TaskShifts",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "TaskShifts",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "TaskShifts",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "Tasks",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "Tasks",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "Tasks",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "TaskRoutines",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "TaskRoutines",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "TaskRoutines",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "TaskPositions",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "TaskPositions",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "TaskPositions",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "TaskDays",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "TaskDays",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "TaskDays",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "Shifts",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "Shifts",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "Shifts",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "ShiftRoutines",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "ShiftRoutines",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "ShiftRoutines",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "ShiftPlanUsers",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "ShiftPlanUsers",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "ShiftPlanUsers",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "ShiftPlans",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "ShiftPlans",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "ShiftPlans",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "ShiftDays",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "ShiftDays",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "ShiftDays",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "Sections",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "Sections",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "Sections",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "Routines",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "Routines",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "Routines",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "Positions",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "Positions",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "Positions",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "ComplexUsers",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "ComplexUsers",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "ComplexUsers",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "ComplexUserRoles",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "ComplexUserRoles",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "ComplexUserRoles",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "Complexes",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "Complexes",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "Complexes",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.CreateTable(
name: "PositionPermissions",
schema: "public",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
PositionId = table.Column(type: "uuid", nullable: false),
Permission = table.Column(type: "text", nullable: false),
RemovedAt = table.Column(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column(type: "text", nullable: false),
IsRemoved = table.Column(type: "boolean", nullable: false),
RemovedBy = table.Column(type: "text", nullable: false),
ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PositionPermissions", x => x.Id);
table.ForeignKey(
name: "FK_PositionPermissions_Positions_PositionId",
column: x => x.PositionId,
principalSchema: "public",
principalTable: "Positions",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_PositionPermissions_PositionId",
schema: "public",
table: "PositionPermissions",
column: "PositionId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PositionPermissions",
schema: "public");
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "TaskShifts",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "TaskShifts",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "TaskShifts",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "Tasks",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "Tasks",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "Tasks",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "TaskRoutines",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "TaskRoutines",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "TaskRoutines",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "TaskPositions",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "TaskPositions",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "TaskPositions",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "TaskDays",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "TaskDays",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "TaskDays",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "Shifts",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "Shifts",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "Shifts",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "ShiftRoutines",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "ShiftRoutines",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "ShiftRoutines",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "ShiftPlanUsers",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "ShiftPlanUsers",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "ShiftPlanUsers",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "ShiftPlans",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "ShiftPlans",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "ShiftPlans",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "ShiftDays",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "ShiftDays",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "ShiftDays",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "Sections",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "Sections",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "Sections",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "Routines",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "Routines",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "Routines",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "Positions",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "Positions",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "Positions",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "ComplexUsers",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "ComplexUsers",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "ComplexUsers",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "ComplexUserRoles",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "ComplexUserRoles",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "ComplexUserRoles",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "RemovedBy",
schema: "public",
table: "Complexes",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "ModifiedBy",
schema: "public",
table: "Complexes",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn(
name: "CreatedBy",
schema: "public",
table: "Complexes",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
}
}
}