101 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			101 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
using System;
 | 
						|
using Microsoft.EntityFrameworkCore.Migrations;
 | 
						|
 | 
						|
#nullable disable
 | 
						|
 | 
						|
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
 | 
						|
 | 
						|
namespace Marco.Pms.DataAccess.Migrations
 | 
						|
{
 | 
						|
    /// <inheritdoc />
 | 
						|
    public partial class Added_Feature_Directory_Management : Migration
 | 
						|
    {
 | 
						|
        /// <inheritdoc />
 | 
						|
        protected override void Up(MigrationBuilder migrationBuilder)
 | 
						|
        {
 | 
						|
            migrationBuilder.AddColumn<DateTime>(
 | 
						|
                name: "CreatedAt",
 | 
						|
                table: "Buckets",
 | 
						|
                type: "datetime(6)",
 | 
						|
                nullable: false,
 | 
						|
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
 | 
						|
 | 
						|
            migrationBuilder.AddColumn<Guid>(
 | 
						|
                name: "CreatedByID",
 | 
						|
                table: "Buckets",
 | 
						|
                type: "char(36)",
 | 
						|
                nullable: false,
 | 
						|
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
 | 
						|
                collation: "ascii_general_ci");
 | 
						|
 | 
						|
            migrationBuilder.InsertData(
 | 
						|
                table: "Features",
 | 
						|
                columns: new[] { "Id", "Description", "IsActive", "ModuleId", "Name" },
 | 
						|
                values: new object[] { new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), "Managing all directory related rights", true, new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), "Directory Management" });
 | 
						|
 | 
						|
            migrationBuilder.InsertData(
 | 
						|
                table: "FeaturePermissions",
 | 
						|
                columns: new[] { "Id", "Description", "FeatureId", "IsEnabled", "Name" },
 | 
						|
                values: new object[,]
 | 
						|
                {
 | 
						|
                    { new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created.", new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), true, "Directory User" },
 | 
						|
                    { new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), "Full control over all directories, including the ability to manage permissions for all directories in the system.", new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), true, "Directory Admin" },
 | 
						|
                    { new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), "Full control over directories they created or have been assigned. Can also manage permissions for those directories.", new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), true, "Directory Manager" }
 | 
						|
                });
 | 
						|
 | 
						|
            migrationBuilder.CreateIndex(
 | 
						|
                name: "IX_Buckets_CreatedByID",
 | 
						|
                table: "Buckets",
 | 
						|
                column: "CreatedByID");
 | 
						|
 | 
						|
            migrationBuilder.AddForeignKey(
 | 
						|
                name: "FK_Buckets_Employees_CreatedByID",
 | 
						|
                table: "Buckets",
 | 
						|
                column: "CreatedByID",
 | 
						|
                principalTable: "Employees",
 | 
						|
                principalColumn: "Id",
 | 
						|
                onDelete: ReferentialAction.Cascade);
 | 
						|
        }
 | 
						|
 | 
						|
        /// <inheritdoc />
 | 
						|
        protected override void Down(MigrationBuilder migrationBuilder)
 | 
						|
        {
 | 
						|
            migrationBuilder.DropForeignKey(
 | 
						|
                name: "FK_Buckets_Employees_CreatedByID",
 | 
						|
                table: "Buckets");
 | 
						|
 | 
						|
            migrationBuilder.DropIndex(
 | 
						|
                name: "IX_Buckets_CreatedByID",
 | 
						|
                table: "Buckets");
 | 
						|
 | 
						|
            migrationBuilder.DeleteData(
 | 
						|
                table: "FeaturePermissions",
 | 
						|
                keyColumn: "Id",
 | 
						|
                keyValue: new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"));
 | 
						|
 | 
						|
            migrationBuilder.DeleteData(
 | 
						|
                table: "FeaturePermissions",
 | 
						|
                keyColumn: "Id",
 | 
						|
                keyValue: new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"));
 | 
						|
 | 
						|
            migrationBuilder.DeleteData(
 | 
						|
                table: "FeaturePermissions",
 | 
						|
                keyColumn: "Id",
 | 
						|
                keyValue: new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"));
 | 
						|
 | 
						|
            migrationBuilder.DeleteData(
 | 
						|
                table: "Features",
 | 
						|
                keyColumn: "Id",
 | 
						|
                keyValue: new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"));
 | 
						|
 | 
						|
            migrationBuilder.DropColumn(
 | 
						|
                name: "CreatedAt",
 | 
						|
                table: "Buckets");
 | 
						|
 | 
						|
            migrationBuilder.DropColumn(
 | 
						|
                name: "CreatedByID",
 | 
						|
                table: "Buckets");
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |