1392 lines
69 KiB
C#
1392 lines
69 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
|
|
|
namespace Marco.Pms.DataAccess.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class initmigration : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AlterDatabase()
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AspNetRoles",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<string>(type: "varchar(255)", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Name = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
NormalizedName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
ConcurrencyStamp = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AspNetRoles", x => x.Id);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AspNetUsers",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<string>(type: "varchar(255)", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Discriminator = table.Column<string>(type: "varchar(21)", maxLength: 21, nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Role = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
TenantId = table.Column<int>(type: "int", nullable: true),
|
|
IsRootUser = table.Column<bool>(type: "tinyint(1)", nullable: true),
|
|
UserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
NormalizedUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Email = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
NormalizedEmail = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
EmailConfirmed = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
PasswordHash = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
SecurityStamp = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
ConcurrencyStamp = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
PhoneNumber = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
PhoneNumberConfirmed = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
TwoFactorEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
LockoutEnd = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: true),
|
|
LockoutEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
AccessFailedCount = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Modules",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
Name = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Description = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Key = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Modules", x => x.Id);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Tenants",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
Name = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Description = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
DomainName = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
ContactName = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
ContactNumber = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
OnBoardingDate = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Tenants", x => x.Id);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AspNetRoleClaims",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
RoleId = table.Column<string>(type: "varchar(255)", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
ClaimType = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
ClaimValue = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
|
|
column: x => x.RoleId,
|
|
principalTable: "AspNetRoles",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AspNetUserClaims",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
UserId = table.Column<string>(type: "varchar(255)", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
ClaimType = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
ClaimValue = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_AspNetUserClaims_AspNetUsers_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AspNetUserLogins",
|
|
columns: table => new
|
|
{
|
|
LoginProvider = table.Column<string>(type: "varchar(255)", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
ProviderKey = table.Column<string>(type: "varchar(255)", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
ProviderDisplayName = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
UserId = table.Column<string>(type: "varchar(255)", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
|
|
table.ForeignKey(
|
|
name: "FK_AspNetUserLogins_AspNetUsers_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AspNetUserRoles",
|
|
columns: table => new
|
|
{
|
|
UserId = table.Column<string>(type: "varchar(255)", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
RoleId = table.Column<string>(type: "varchar(255)", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
|
|
table.ForeignKey(
|
|
name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
|
|
column: x => x.RoleId,
|
|
principalTable: "AspNetRoles",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_AspNetUserRoles_AspNetUsers_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AspNetUserTokens",
|
|
columns: table => new
|
|
{
|
|
UserId = table.Column<string>(type: "varchar(255)", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
LoginProvider = table.Column<string>(type: "varchar(255)", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Name = table.Column<string>(type: "varchar(255)", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Value = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
|
|
table.ForeignKey(
|
|
name: "FK_AspNetUserTokens_AspNetUsers_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "RefreshTokens",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
Token = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
UserId = table.Column<string>(type: "varchar(255)", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
ExpiryDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
IsRevoked = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
IsUsed = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
RevokedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_RefreshTokens", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_RefreshTokens_AspNetUsers_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Features",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
ModuleId = table.Column<int>(type: "int", nullable: false),
|
|
Name = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Description = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Features", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Features_Modules_ModuleId",
|
|
column: x => x.ModuleId,
|
|
principalTable: "Modules",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "ApplicationRoles",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
Role = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Description = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
TenantId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_ApplicationRoles", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_ApplicationRoles_Tenants_TenantId",
|
|
column: x => x.TenantId,
|
|
principalTable: "Tenants",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Buildings",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
Name = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Description = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
ProjectId = table.Column<int>(type: "int", nullable: false),
|
|
TenantId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Buildings", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Buildings_Tenants_TenantId",
|
|
column: x => x.TenantId,
|
|
principalTable: "Tenants",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "JobRoles",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
Name = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Description = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
TenantId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_JobRoles", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_JobRoles_Tenants_TenantId",
|
|
column: x => x.TenantId,
|
|
principalTable: "Tenants",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "StatusMasters",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
Status = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
TenantId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_StatusMasters", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_StatusMasters_Tenants_TenantId",
|
|
column: x => x.TenantId,
|
|
principalTable: "Tenants",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "WorkShifts",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
Name = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
StartTime = table.Column<TimeOnly>(type: "time(6)", nullable: false),
|
|
EndTime = table.Column<TimeOnly>(type: "time(6)", nullable: false),
|
|
TenantId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_WorkShifts", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_WorkShifts_Tenants_TenantId",
|
|
column: x => x.TenantId,
|
|
principalTable: "Tenants",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "FeaturePermissions",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
FeatureId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
Name = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Description = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_FeaturePermissions", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_FeaturePermissions_Features_FeatureId",
|
|
column: x => x.FeatureId,
|
|
principalTable: "Features",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Floor",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
FloorName = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
BuildingId = table.Column<int>(type: "int", nullable: false),
|
|
TenantId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Floor", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Floor_Buildings_BuildingId",
|
|
column: x => x.BuildingId,
|
|
principalTable: "Buildings",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_Floor_Tenants_TenantId",
|
|
column: x => x.TenantId,
|
|
principalTable: "Tenants",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Employees",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
FirstName = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
LastName = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
MiddleName = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Email = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Gender = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
BirthDate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
|
JoiningDate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
|
PeramnentAddress = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
CurrentAddress = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
PhoneNumber = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
EmergencyPhoneNumber = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
EmergencyContactPerson = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
AadharNumber = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
PanNumber = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Photo = table.Column<byte[]>(type: "longblob", nullable: true),
|
|
ApplicationUserId = table.Column<string>(type: "varchar(255)", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
TenantId = table.Column<int>(type: "int", nullable: false),
|
|
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
RoleId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
JobRoleId = table.Column<int>(type: "int", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Employees", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Employees_AspNetUsers_ApplicationUserId",
|
|
column: x => x.ApplicationUserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id");
|
|
table.ForeignKey(
|
|
name: "FK_Employees_JobRoles_JobRoleId",
|
|
column: x => x.JobRoleId,
|
|
principalTable: "JobRoles",
|
|
principalColumn: "Id");
|
|
table.ForeignKey(
|
|
name: "FK_Employees_Tenants_TenantId",
|
|
column: x => x.TenantId,
|
|
principalTable: "Tenants",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Projects",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
Name = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
ProjectAddress = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
ContactPerson = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
StartDate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
|
EndDate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
|
ProjectStatusId = table.Column<int>(type: "int", nullable: false),
|
|
TenantId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Projects", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Projects_StatusMasters_ProjectStatusId",
|
|
column: x => x.ProjectStatusId,
|
|
principalTable: "StatusMasters",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_Projects_Tenants_TenantId",
|
|
column: x => x.TenantId,
|
|
principalTable: "Tenants",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "RolePermissionMappings",
|
|
columns: table => new
|
|
{
|
|
ApplicationRoleId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
FeaturePermissionId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_RolePermissionMappings", x => new { x.ApplicationRoleId, x.FeaturePermissionId });
|
|
table.ForeignKey(
|
|
name: "FK_RolePermissionMappings_ApplicationRoles_ApplicationRoleId",
|
|
column: x => x.ApplicationRoleId,
|
|
principalTable: "ApplicationRoles",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_RolePermissionMappings_FeaturePermissions_FeaturePermissionId",
|
|
column: x => x.FeaturePermissionId,
|
|
principalTable: "FeaturePermissions",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "WorkAreas",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
AreaName = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
FloorId = table.Column<int>(type: "int", nullable: false),
|
|
TenantId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_WorkAreas", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_WorkAreas_Floor_FloorId",
|
|
column: x => x.FloorId,
|
|
principalTable: "Floor",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_WorkAreas_Tenants_TenantId",
|
|
column: x => x.TenantId,
|
|
principalTable: "Tenants",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Attendes",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
Comment = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
EmployeeID = table.Column<int>(type: "int", nullable: false),
|
|
Date = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
ProjectID = table.Column<int>(type: "int", nullable: false),
|
|
AttendanceDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
InTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
|
OutTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
|
IsApproved = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
Activity = table.Column<int>(type: "int", nullable: false),
|
|
ApprovedBy = table.Column<int>(type: "int", nullable: true),
|
|
TenantId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Attendes", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Attendes_Employees_EmployeeID",
|
|
column: x => x.EmployeeID,
|
|
principalTable: "Employees",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_Attendes_Tenants_TenantId",
|
|
column: x => x.TenantId,
|
|
principalTable: "Tenants",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "EmployeeRoleMappings",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
EmployeeId = table.Column<int>(type: "int", nullable: false),
|
|
RoleId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
TenantId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_EmployeeRoleMappings", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_EmployeeRoleMappings_ApplicationRoles_RoleId",
|
|
column: x => x.RoleId,
|
|
principalTable: "ApplicationRoles",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_EmployeeRoleMappings_Employees_EmployeeId",
|
|
column: x => x.EmployeeId,
|
|
principalTable: "Employees",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_EmployeeRoleMappings_Tenants_TenantId",
|
|
column: x => x.TenantId,
|
|
principalTable: "Tenants",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "ProjectAllocations",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
EmployeeId = table.Column<int>(type: "int", nullable: false),
|
|
JobRoleId = table.Column<int>(type: "int", nullable: true),
|
|
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
ProjectId = table.Column<int>(type: "int", nullable: false),
|
|
AllocationDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
ReAllocationDate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
|
TenantId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_ProjectAllocations", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_ProjectAllocations_Employees_EmployeeId",
|
|
column: x => x.EmployeeId,
|
|
principalTable: "Employees",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_ProjectAllocations_Projects_ProjectId",
|
|
column: x => x.ProjectId,
|
|
principalTable: "Projects",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_ProjectAllocations_Tenants_TenantId",
|
|
column: x => x.TenantId,
|
|
principalTable: "Tenants",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "TaskAllocations",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
EmployeeId = table.Column<int>(type: "int", nullable: false),
|
|
EmployeeRole = table.Column<int>(type: "int", nullable: false),
|
|
ProjectId = table.Column<int>(type: "int", nullable: false),
|
|
BuildingId = table.Column<int>(type: "int", nullable: false),
|
|
AllocationDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
ReAllocationDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
WorkAreaId = table.Column<int>(type: "int", nullable: false),
|
|
TenantId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_TaskAllocations", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_TaskAllocations_Buildings_BuildingId",
|
|
column: x => x.BuildingId,
|
|
principalTable: "Buildings",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_TaskAllocations_Employees_EmployeeId",
|
|
column: x => x.EmployeeId,
|
|
principalTable: "Employees",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_TaskAllocations_Projects_ProjectId",
|
|
column: x => x.ProjectId,
|
|
principalTable: "Projects",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_TaskAllocations_Tenants_TenantId",
|
|
column: x => x.TenantId,
|
|
principalTable: "Tenants",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_TaskAllocations_WorkAreas_WorkAreaId",
|
|
column: x => x.WorkAreaId,
|
|
principalTable: "WorkAreas",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AttendanceLogs",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
Comment = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
AttendanceId = table.Column<int>(type: "int", nullable: false),
|
|
EmployeeID = table.Column<int>(type: "int", nullable: false),
|
|
ActivityTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
|
Activity = table.Column<int>(type: "int", nullable: false),
|
|
Photo = table.Column<byte[]>(type: "longblob", nullable: true),
|
|
Latitude = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Longitude = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
UpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
UpdatedBy = table.Column<int>(type: "int", nullable: true),
|
|
TenantId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AttendanceLogs", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_AttendanceLogs_Attendes_AttendanceId",
|
|
column: x => x.AttendanceId,
|
|
principalTable: "Attendes",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_AttendanceLogs_Employees_EmployeeID",
|
|
column: x => x.EmployeeID,
|
|
principalTable: "Employees",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_AttendanceLogs_Employees_UpdatedBy",
|
|
column: x => x.UpdatedBy,
|
|
principalTable: "Employees",
|
|
principalColumn: "Id");
|
|
table.ForeignKey(
|
|
name: "FK_AttendanceLogs_Tenants_TenantId",
|
|
column: x => x.TenantId,
|
|
principalTable: "Tenants",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "ActivityMasters",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
ActivityName = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
UnitOfMeasurement = table.Column<string>(type: "longtext", nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
TenantId = table.Column<int>(type: "int", nullable: false),
|
|
TaskAllocationId = table.Column<int>(type: "int", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_ActivityMasters", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_ActivityMasters_TaskAllocations_TaskAllocationId",
|
|
column: x => x.TaskAllocationId,
|
|
principalTable: "TaskAllocations",
|
|
principalColumn: "Id");
|
|
table.ForeignKey(
|
|
name: "FK_ActivityMasters_Tenants_TenantId",
|
|
column: x => x.TenantId,
|
|
principalTable: "Tenants",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "WorkItems",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
ActivityId = table.Column<int>(type: "int", nullable: false),
|
|
WorkAreaId = table.Column<int>(type: "int", nullable: false),
|
|
PlannedWork = table.Column<int>(type: "int", nullable: false),
|
|
CompletedWork = table.Column<int>(type: "int", nullable: false),
|
|
TaskDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
TenantId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_WorkItems", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_WorkItems_ActivityMasters_ActivityId",
|
|
column: x => x.ActivityId,
|
|
principalTable: "ActivityMasters",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_WorkItems_Tenants_TenantId",
|
|
column: x => x.TenantId,
|
|
principalTable: "Tenants",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_WorkItems_WorkAreas_WorkAreaId",
|
|
column: x => x.WorkAreaId,
|
|
principalTable: "WorkAreas",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "WorkItemMapping",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
WorkAreaId = table.Column<int>(type: "int", nullable: false),
|
|
WorkItemId = table.Column<int>(type: "int", nullable: false),
|
|
TenantId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_WorkItemMapping", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_WorkItemMapping_Tenants_TenantId",
|
|
column: x => x.TenantId,
|
|
principalTable: "Tenants",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_WorkItemMapping_WorkAreas_WorkAreaId",
|
|
column: x => x.WorkAreaId,
|
|
principalTable: "WorkAreas",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_WorkItemMapping_WorkItems_WorkItemId",
|
|
column: x => x.WorkItemId,
|
|
principalTable: "WorkItems",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "Modules",
|
|
columns: new[] { "Id", "Description", "Key", "Name" },
|
|
values: new object[,]
|
|
{
|
|
{ 1, "Project Module", "b04da7e9-0406-409c-ac7f-b97256e6ea02", "Project" },
|
|
{ 2, "Employee Module", "0971c7fb-6ce1-458a-ae3f-8d3205893637", "Employee" },
|
|
{ 3, "Masters Module", "504ec132-e6a9-422f-8f85-050602cfce05", "Masters" }
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "Tenants",
|
|
columns: new[] { "Id", "ContactName", "ContactNumber", "Description", "DomainName", "Name", "OnBoardingDate" },
|
|
values: new object[] { 1, "Admin", "123456789", "", "www.marcobms.org", "MarcoBMS", new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) });
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "ActivityMasters",
|
|
columns: new[] { "Id", "ActivityName", "TaskAllocationId", "TenantId", "UnitOfMeasurement" },
|
|
values: new object[,]
|
|
{
|
|
{ 1, "Core Cutting", null, 1, "Number" },
|
|
{ 2, "Fabrication", null, 1, "Meter" },
|
|
{ 3, "Lifting", null, 1, "Meter" },
|
|
{ 4, "Hanging", null, 1, "Meter" },
|
|
{ 5, "Tapping", null, 1, "Meter" },
|
|
{ 6, "Welding", null, 1, "Meter" },
|
|
{ 7, "Testing", null, 1, "Area" },
|
|
{ 8, "Painting", null, 1, "Meter" },
|
|
{ 9, "Marking Area", null, 1, "Meter" },
|
|
{ 10, "Drilling", null, 1, "Number" },
|
|
{ 11, "MS Support Fabrication", null, 1, "Number" },
|
|
{ 12, "MS Support Hanging", null, 1, "Number" },
|
|
{ 13, "Hydrant Volve", null, 1, "Number" },
|
|
{ 14, "Sprinkler Installation", null, 1, "Number" }
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "ApplicationRoles",
|
|
columns: new[] { "Id", "Description", "Role", "TenantId" },
|
|
values: new object[,]
|
|
{
|
|
{ new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"), "", "Admin", 1 },
|
|
{ new Guid("62e0918d-c421-11ef-9b93-0242ac110002"), "", "Welder", 1 },
|
|
{ new Guid("68823f1f-c421-11ef-9b93-0242ac110002"), "", "Helper", 1 },
|
|
{ new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"), "", "Site Engineer", 1 },
|
|
{ new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"), "", "Project Manager", 1 }
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "Features",
|
|
columns: new[] { "Id", "Description", "IsActive", "ModuleId", "Name" },
|
|
values: new object[,]
|
|
{
|
|
{ new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), "Assign and Update Tasks Progress", true, 1, "Assign and Update Tasks Progress" },
|
|
{ new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), "Attendance", true, 2, "Attendance" },
|
|
{ new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), "Manage Project", true, 1, "Manage Project" },
|
|
{ new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), "Tenant Masters", true, 3, "Tenant Masters" },
|
|
{ new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), "Manage Employee", true, 2, "Manage Employee" },
|
|
{ new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), "Manage Infra", true, 1, "Manage Infra" },
|
|
{ new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), "Manage Tasks", true, 1, "Manage Tasks" },
|
|
{ new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), "Global Masters", true, 3, "Global Masters" }
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "StatusMasters",
|
|
columns: new[] { "Id", "Status", "TenantId" },
|
|
values: new object[,]
|
|
{
|
|
{ 1, "Active", 1 },
|
|
{ 2, "In Progress", 1 },
|
|
{ 3, "On Hold", 1 },
|
|
{ 4, "Completed", 1 }
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "FeaturePermissions",
|
|
columns: new[] { "Id", "Description", "FeatureId", "IsEnabled", "Name" },
|
|
values: new object[,]
|
|
{
|
|
{ new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), "", new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), true, "Manage Task" },
|
|
{ new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), "", new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), true, "Manage Project" },
|
|
{ new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), "", new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), true, "Regularize Attendance" },
|
|
{ new Guid("588a8824-f924-4955-82d8-fc51956cf323"), "", new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), true, "Manage Masters" },
|
|
{ new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), "", new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), true, "View Masters" },
|
|
{ new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), "", new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), true, "Manage Masters" },
|
|
{ new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), "", new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), true, "View Project" },
|
|
{ new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), "", new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), true, "Perform Attendance " },
|
|
{ new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), "", new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), true, "View Task" },
|
|
{ new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), "", new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), true, "Manage Employee" },
|
|
{ new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), "", new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), true, "View Employee" },
|
|
{ new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), "", new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), true, "Manage Team" },
|
|
{ new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), "", new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), true, "View Project Infra" },
|
|
{ new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), "", new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), true, "View Masters" },
|
|
{ new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), "", new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), true, "Assign Task and Report Progress" },
|
|
{ new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), "", new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), true, "Approve Task" },
|
|
{ new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), "", new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), true, "Manage Project Infra" },
|
|
{ new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), "", new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), true, "Assign To Project" }
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "Projects",
|
|
columns: new[] { "Id", "ContactPerson", "EndDate", "Name", "ProjectAddress", "ProjectStatusId", "StartDate", "TenantId" },
|
|
values: new object[,]
|
|
{
|
|
{ 1, "Project 1 Contact Person", null, "Project 1", "Project 1 Address", 1, null, 1 },
|
|
{ 2, "Project 2 Contact Person", null, "Project 2", "Project 2 Address", 2, null, 1 },
|
|
{ 3, "Project 3 Contact Person", null, "Project 3", "Project 3 Address", 3, null, 1 }
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ActivityMasters_TaskAllocationId",
|
|
table: "ActivityMasters",
|
|
column: "TaskAllocationId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ActivityMasters_TenantId",
|
|
table: "ActivityMasters",
|
|
column: "TenantId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ApplicationRoles_TenantId",
|
|
table: "ApplicationRoles",
|
|
column: "TenantId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AspNetRoleClaims_RoleId",
|
|
table: "AspNetRoleClaims",
|
|
column: "RoleId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "RoleNameIndex",
|
|
table: "AspNetRoles",
|
|
column: "NormalizedName",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AspNetUserClaims_UserId",
|
|
table: "AspNetUserClaims",
|
|
column: "UserId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AspNetUserLogins_UserId",
|
|
table: "AspNetUserLogins",
|
|
column: "UserId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AspNetUserRoles_RoleId",
|
|
table: "AspNetUserRoles",
|
|
column: "RoleId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "EmailIndex",
|
|
table: "AspNetUsers",
|
|
column: "NormalizedEmail");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "UserNameIndex",
|
|
table: "AspNetUsers",
|
|
column: "NormalizedUserName",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AttendanceLogs_AttendanceId",
|
|
table: "AttendanceLogs",
|
|
column: "AttendanceId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AttendanceLogs_EmployeeID",
|
|
table: "AttendanceLogs",
|
|
column: "EmployeeID");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AttendanceLogs_TenantId",
|
|
table: "AttendanceLogs",
|
|
column: "TenantId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AttendanceLogs_UpdatedBy",
|
|
table: "AttendanceLogs",
|
|
column: "UpdatedBy");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Attendes_EmployeeID",
|
|
table: "Attendes",
|
|
column: "EmployeeID");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Attendes_TenantId",
|
|
table: "Attendes",
|
|
column: "TenantId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Buildings_TenantId",
|
|
table: "Buildings",
|
|
column: "TenantId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_EmployeeRoleMappings_EmployeeId",
|
|
table: "EmployeeRoleMappings",
|
|
column: "EmployeeId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_EmployeeRoleMappings_RoleId",
|
|
table: "EmployeeRoleMappings",
|
|
column: "RoleId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_EmployeeRoleMappings_TenantId",
|
|
table: "EmployeeRoleMappings",
|
|
column: "TenantId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Employees_ApplicationUserId",
|
|
table: "Employees",
|
|
column: "ApplicationUserId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Employees_JobRoleId",
|
|
table: "Employees",
|
|
column: "JobRoleId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Employees_TenantId",
|
|
table: "Employees",
|
|
column: "TenantId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_FeaturePermissions_FeatureId",
|
|
table: "FeaturePermissions",
|
|
column: "FeatureId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Features_ModuleId",
|
|
table: "Features",
|
|
column: "ModuleId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Floor_BuildingId",
|
|
table: "Floor",
|
|
column: "BuildingId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Floor_TenantId",
|
|
table: "Floor",
|
|
column: "TenantId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_JobRoles_TenantId",
|
|
table: "JobRoles",
|
|
column: "TenantId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ProjectAllocations_EmployeeId",
|
|
table: "ProjectAllocations",
|
|
column: "EmployeeId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ProjectAllocations_ProjectId",
|
|
table: "ProjectAllocations",
|
|
column: "ProjectId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ProjectAllocations_TenantId",
|
|
table: "ProjectAllocations",
|
|
column: "TenantId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Projects_ProjectStatusId",
|
|
table: "Projects",
|
|
column: "ProjectStatusId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Projects_TenantId",
|
|
table: "Projects",
|
|
column: "TenantId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_RefreshTokens_UserId",
|
|
table: "RefreshTokens",
|
|
column: "UserId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_RolePermissionMappings_FeaturePermissionId",
|
|
table: "RolePermissionMappings",
|
|
column: "FeaturePermissionId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_StatusMasters_TenantId",
|
|
table: "StatusMasters",
|
|
column: "TenantId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_TaskAllocations_BuildingId",
|
|
table: "TaskAllocations",
|
|
column: "BuildingId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_TaskAllocations_EmployeeId",
|
|
table: "TaskAllocations",
|
|
column: "EmployeeId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_TaskAllocations_ProjectId",
|
|
table: "TaskAllocations",
|
|
column: "ProjectId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_TaskAllocations_TenantId",
|
|
table: "TaskAllocations",
|
|
column: "TenantId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_TaskAllocations_WorkAreaId",
|
|
table: "TaskAllocations",
|
|
column: "WorkAreaId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_WorkAreas_FloorId",
|
|
table: "WorkAreas",
|
|
column: "FloorId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_WorkAreas_TenantId",
|
|
table: "WorkAreas",
|
|
column: "TenantId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_WorkItemMapping_TenantId",
|
|
table: "WorkItemMapping",
|
|
column: "TenantId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_WorkItemMapping_WorkAreaId",
|
|
table: "WorkItemMapping",
|
|
column: "WorkAreaId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_WorkItemMapping_WorkItemId",
|
|
table: "WorkItemMapping",
|
|
column: "WorkItemId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_WorkItems_ActivityId",
|
|
table: "WorkItems",
|
|
column: "ActivityId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_WorkItems_TenantId",
|
|
table: "WorkItems",
|
|
column: "TenantId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_WorkItems_WorkAreaId",
|
|
table: "WorkItems",
|
|
column: "WorkAreaId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_WorkShifts_TenantId",
|
|
table: "WorkShifts",
|
|
column: "TenantId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "AspNetRoleClaims");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AspNetUserClaims");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AspNetUserLogins");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AspNetUserRoles");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AspNetUserTokens");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AttendanceLogs");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "EmployeeRoleMappings");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "ProjectAllocations");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "RefreshTokens");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "RolePermissionMappings");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "WorkItemMapping");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "WorkShifts");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AspNetRoles");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Attendes");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "ApplicationRoles");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "FeaturePermissions");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "WorkItems");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Features");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "ActivityMasters");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Modules");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "TaskAllocations");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Employees");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Projects");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "WorkAreas");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AspNetUsers");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "JobRoles");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "StatusMasters");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Floor");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Buildings");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Tenants");
|
|
}
|
|
}
|
|
}
|