using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace Marco.Pms.DataAccess.Migrations
{
///
public partial class Initmigration : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "ActivityCheckLists",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ActivityId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Description = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
IsChecked = table.Column(type: "tinyint(1)", nullable: false),
IsMandatory = table.Column(type: "tinyint(1)", nullable: false),
TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_ActivityCheckLists", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "AspNetRoles",
columns: table => new
{
Id = table.Column(type: "varchar(255)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Name = table.Column(type: "varchar(256)", maxLength: 256, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
NormalizedName = table.Column(type: "varchar(256)", maxLength: 256, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
ConcurrencyStamp = table.Column(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(type: "varchar(255)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Discriminator = table.Column(type: "varchar(21)", maxLength: 21, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
TenantId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
IsRootUser = table.Column(type: "tinyint(1)", nullable: true),
IsActive = table.Column(type: "tinyint(1)", nullable: true),
UserName = table.Column(type: "varchar(256)", maxLength: 256, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
NormalizedUserName = table.Column(type: "varchar(256)", maxLength: 256, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Email = table.Column(type: "varchar(256)", maxLength: 256, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
NormalizedEmail = table.Column(type: "varchar(256)", maxLength: 256, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
EmailConfirmed = table.Column(type: "tinyint(1)", nullable: false),
PasswordHash = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
SecurityStamp = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
ConcurrencyStamp = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
PhoneNumber = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
PhoneNumberConfirmed = table.Column(type: "tinyint(1)", nullable: false),
TwoFactorEnabled = table.Column(type: "tinyint(1)", nullable: false),
LockoutEnd = table.Column(type: "datetime(6)", nullable: true),
LockoutEnabled = table.Column(type: "tinyint(1)", nullable: false),
AccessFailedCount = table.Column(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "CheckListMappings",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
TaskAllocationId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
CheckListId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_CheckListMappings", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Industries",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Name = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_Industries", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Inquiries",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
OrganizatioinName = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Email = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
About = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
OragnizationSize = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
IndustryId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ContactPerson = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
ContactNumber = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_Inquiries", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Modules",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Name = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Key = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_Modules", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "TicketPriorityMasters",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Name = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Level = table.Column(type: "int", nullable: false),
ColorCode = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
IsDefault = table.Column(type: "tinyint(1)", nullable: false),
TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_TicketPriorityMasters", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "TicketStatusMasters",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Name = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
ColorCode = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
IsDefault = table.Column(type: "tinyint(1)", nullable: false),
TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_TicketStatusMasters", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "TicketTagMasters",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Name = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ColorCode = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
IsDefault = table.Column(type: "tinyint(1)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TicketTagMasters", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "TicketTypeMasters",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Name = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
IsDefault = table.Column(type: "tinyint(1)", nullable: false),
TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_TicketTypeMasters", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "AspNetRoleClaims",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
RoleId = table.Column(type: "varchar(255)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ClaimType = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
ClaimValue = table.Column(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(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
UserId = table.Column(type: "varchar(255)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ClaimType = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
ClaimValue = table.Column(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(type: "varchar(255)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ProviderKey = table.Column(type: "varchar(255)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ProviderDisplayName = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
UserId = table.Column(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(type: "varchar(255)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
RoleId = table.Column(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(type: "varchar(255)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
LoginProvider = table.Column(type: "varchar(255)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Name = table.Column(type: "varchar(255)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Value = table.Column(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(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Token = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
UserId = table.Column(type: "varchar(255)", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
ExpiryDate = table.Column(type: "datetime(6)", nullable: false),
IsRevoked = table.Column(type: "tinyint(1)", nullable: false),
IsUsed = table.Column(type: "tinyint(1)", nullable: false),
CreatedAt = table.Column(type: "datetime(6)", nullable: false),
RevokedAt = table.Column(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: "Tenants",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Name = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
DomainName = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
ContactName = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
ContactNumber = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
OnBoardingDate = table.Column(type: "datetime(6)", nullable: false),
OragnizationSize = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
IndustryId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
IsActive = table.Column(type: "tinyint(1)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Tenants", x => x.Id);
table.ForeignKey(
name: "FK_Tenants_Industries_IndustryId",
column: x => x.IndustryId,
principalTable: "Industries",
principalColumn: "Id");
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Features",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ModuleId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Name = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
IsActive = table.Column(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: "ActivityMasters",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ActivityName = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
UnitOfMeasurement = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
IsActive = table.Column(type: "tinyint(1)", nullable: false),
TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_ActivityMasters", x => x.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: "ApplicationRoles",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Role = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
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(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Name = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
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: "Documents",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
BatchId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
FileName = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
S3Key = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ThumbS3Key = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Base64Data = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
FileSize = table.Column(type: "bigint", nullable: false),
ContentType = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
UploadedAt = table.Column(type: "datetime(6)", nullable: false),
TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_Documents", x => x.Id);
table.ForeignKey(
name: "FK_Documents_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(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Name = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
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(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Status = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
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: "TicketComments",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
TicketId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
AuthorId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
MessageText = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
SentAt = table.Column(type: "datetime(6)", nullable: false),
ParentMessageId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_TicketComments", x => x.Id);
table.ForeignKey(
name: "FK_TicketComments_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Tickets",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Subject = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
StatusId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
TypeId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
CreatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
CreatedAt = table.Column(type: "datetime(6)", nullable: false),
LinkedProjectId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
LinkedActivityId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
PriorityId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_Tickets", x => x.Id);
table.ForeignKey(
name: "FK_Tickets_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Tickets_TicketPriorityMasters_PriorityId",
column: x => x.PriorityId,
principalTable: "TicketPriorityMasters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Tickets_TicketStatusMasters_StatusId",
column: x => x.StatusId,
principalTable: "TicketStatusMasters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Tickets_TicketTypeMasters_TypeId",
column: x => x.TypeId,
principalTable: "TicketTypeMasters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "WorkShifts",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Name = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
StartTime = table.Column(type: "time(6)", nullable: false),
EndTime = table.Column(type: "time(6)", nullable: false),
TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
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(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
FeatureId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Name = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
IsEnabled = table.Column(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(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
FloorName = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
BuildingId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
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(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
FirstName = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
LastName = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
MiddleName = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Email = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Gender = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
BirthDate = table.Column(type: "datetime(6)", nullable: true),
JoiningDate = table.Column(type: "datetime(6)", nullable: true),
PermanentAddress = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
CurrentAddress = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
PhoneNumber = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
EmergencyPhoneNumber = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
EmergencyContactPerson = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
AadharNumber = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
PanNumber = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Photo = table.Column(type: "longblob", nullable: true),
ApplicationUserId = table.Column(type: "varchar(255)", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
IsActive = table.Column(type: "tinyint(1)", nullable: false),
RoleId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
JobRoleId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
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(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Name = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ProjectAddress = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
ContactPerson = table.Column(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
StartDate = table.Column(type: "datetime(6)", nullable: true),
EndDate = table.Column(type: "datetime(6)", nullable: true),
ProjectStatusId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
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: "TicketAttachments",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
TicketId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
CommentId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
FileName = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
FileId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_TicketAttachments", x => x.Id);
table.ForeignKey(
name: "FK_TicketAttachments_TicketComments_CommentId",
column: x => x.CommentId,
principalTable: "TicketComments",
principalColumn: "Id");
table.ForeignKey(
name: "FK_TicketAttachments_Tickets_TicketId",
column: x => x.TicketId,
principalTable: "Tickets",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "TicketTags",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
TicketId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
TagId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_TicketTags", x => x.Id);
table.ForeignKey(
name: "FK_TicketTags_TicketTagMasters_TagId",
column: x => x.TagId,
principalTable: "TicketTagMasters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_TicketTags_Tickets_TicketId",
column: x => x.TicketId,
principalTable: "Tickets",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "RolePermissionMappings",
columns: table => new
{
ApplicationRoleId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
FeaturePermissionId = table.Column(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(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
AreaName = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
FloorId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
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(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Comment = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
EmployeeID = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Date = table.Column(type: "datetime(6)", nullable: false),
ProjectID = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
AttendanceDate = table.Column(type: "datetime(6)", nullable: false),
InTime = table.Column(type: "datetime(6)", nullable: true),
OutTime = table.Column(type: "datetime(6)", nullable: true),
IsApproved = table.Column(type: "tinyint(1)", nullable: false),
Activity = table.Column(type: "int", nullable: false),
ApprovedBy = table.Column(type: "int", nullable: true),
TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
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(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
EmployeeId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
RoleId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
IsEnabled = table.Column(type: "tinyint(1)", nullable: false),
TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
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(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
EmployeeId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
JobRoleId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
IsActive = table.Column(type: "tinyint(1)", nullable: false),
ProjectId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
AllocationDate = table.Column(type: "datetime(6)", nullable: false),
ReAllocationDate = table.Column(type: "datetime(6)", nullable: true),
TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
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: "WorkItems",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ActivityId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
WorkAreaId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
PlannedWork = table.Column(type: "double", nullable: false),
CompletedWork = table.Column(type: "double", nullable: false),
TaskDate = table.Column(type: "datetime(6)", nullable: false),
TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
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: "AttendanceLogs",
columns: table => new
{
Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Comment = table.Column(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
AttendanceId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
EmployeeID = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ActivityTime = table.Column(type: "datetime(6)", nullable: true),
Activity = table.Column(type: "int", nullable: false),
Photo = table.Column(type: "longblob", nullable: true),
Latitude = table.Column