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 { /// public partial class initiateapp : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterDatabase() .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"), Role = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), TenantId = table.Column(type: "int", nullable: true), IsRootUser = 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: "Tenants", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Name = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Description = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), DomainName = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), ContactName = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), ContactNumber = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), OnBoardingDate = table.Column(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(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: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Token = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), UserId = table.Column(type: "varchar(255)", nullable: false) .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: "Buildings", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), 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: "int", nullable: false), TenantId = table.Column(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: "EmployeeRoles", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Role = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), TenantId = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_EmployeeRoles", x => x.Id); table.ForeignKey( name: "FK_EmployeeRoles_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "Feature", 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: false) .Annotation("MySql:CharSet", "utf8mb4"), TenantId = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Feature", x => x.Id); table.ForeignKey( name: "FK_Feature_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: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Status = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), TenantId = table.Column(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(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Name = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), StartTime = table.Column(type: "time(6)", nullable: false), EndTime = table.Column(type: "time(6)", nullable: false), TenantId = table.Column(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: "Floor", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), FloorName = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), BuildingId = table.Column(type: "int", nullable: false), TenantId = table.Column(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(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), FirstName = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), LastName = table.Column(type: "longtext", nullable: false) .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: false) .Annotation("MySql:CharSet", "utf8mb4"), BirthDate = table.Column(type: "datetime(6)", nullable: true), PeramnentAddress = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), CurrentAddress = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), PhoneNumber = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), EmergencyPhoneNumber = table.Column(type: "longtext", nullable: false) .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"), TenantId = table.Column(type: "int", nullable: false), RoleId = 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_EmployeeRoles_RoleId", column: x => x.RoleId, principalTable: "EmployeeRoles", principalColumn: "Id", onDelete: ReferentialAction.Cascade); 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: "FeaturePermission", 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"), RoleId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), IsEnabled = table.Column(type: "tinyint(1)", nullable: false), TenantId = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_FeaturePermission", x => x.Id); table.ForeignKey( name: "FK_FeaturePermission_EmployeeRoles_RoleId", column: x => x.RoleId, principalTable: "EmployeeRoles", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_FeaturePermission_Feature_FeatureId", column: x => x.FeatureId, principalTable: "Feature", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_FeaturePermission_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: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Name = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), ProjectAddress = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), ContactPerson = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), StartDate = table.Column(type: "datetime(6)", nullable: true), EndDate = table.Column(type: "datetime(6)", nullable: true), ProjectStatusId = table.Column(type: "int", nullable: false), TenantId = table.Column(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: "WorkAreas", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), AreaName = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), FloorId = table.Column(type: "int", nullable: false), TenantId = table.Column(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: "AttendanceLogs", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Comment = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), EmployeeID = table.Column(type: "int", nullable: false), CheckTime = table.Column(type: "datetime(6)", nullable: true), IsCheckIn = table.Column(type: "tinyint(1)", nullable: false), Photo = table.Column(type: "longblob", nullable: true), Latitude = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Longitude = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), TenantId = table.Column(type: "int", nullable: false), UpdatedBy = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => { table.PrimaryKey("PK_AttendanceLogs", x => x.Id); table.ForeignKey( name: "FK_AttendanceLogs_Employees_EmployeeID", column: x => x.EmployeeID, principalTable: "Employees", principalColumn: "Id", onDelete: ReferentialAction.Cascade); 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: "ProjectAllocations", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), EmployeeId = table.Column(type: "int", nullable: false), EmployeeRoleId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), ProjectId = table.Column(type: "int", nullable: false), AllocationDate = table.Column(type: "datetime(6)", nullable: false), ReAllocationDate = table.Column(type: "datetime(6)", nullable: true), TenantId = table.Column(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(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), EmployeeId = table.Column(type: "int", nullable: false), EmployeeRole = table.Column(type: "int", nullable: false), ProjectId = table.Column(type: "int", nullable: false), BuildingId = table.Column(type: "int", nullable: false), AllocationDate = table.Column(type: "datetime(6)", nullable: false), ReAllocationDate = table.Column(type: "datetime(6)", nullable: false), WorkAreaId = table.Column(type: "int", nullable: false), TenantId = table.Column(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: "Attendances", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Comment = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), EmployeeID = table.Column(type: "int", nullable: false), Date = table.Column(type: "datetime(6)", nullable: false), InTimeID = table.Column(type: "int", nullable: true), OutTimeID = table.Column(type: "int", nullable: true), IsApproved = table.Column(type: "tinyint(1)", nullable: false), ApprovedBy = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), TenantId = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Attendances", x => x.Id); table.ForeignKey( name: "FK_Attendances_AttendanceLogs_InTimeID", column: x => x.InTimeID, principalTable: "AttendanceLogs", principalColumn: "Id"); table.ForeignKey( name: "FK_Attendances_AttendanceLogs_OutTimeID", column: x => x.OutTimeID, principalTable: "AttendanceLogs", principalColumn: "Id"); table.ForeignKey( name: "FK_Attendances_Employees_EmployeeID", column: x => x.EmployeeID, principalTable: "Employees", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_Attendances_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(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), ActivityName = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), UnitOfMeasurement = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), TenantId = table.Column(type: "int", nullable: false), TaskAllocationId = table.Column(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(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), ActivityId = table.Column(type: "int", nullable: false), WorkAreaId = table.Column(type: "int", nullable: false), PlannedWork = table.Column(type: "int", nullable: false), CompletedWork = table.Column(type: "int", nullable: false), TaskDate = table.Column(type: "datetime(6)", nullable: false), TenantId = table.Column(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(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), WorkAreaId = table.Column(type: "int", nullable: false), WorkItemId = table.Column(type: "int", nullable: false), TenantId = table.Column(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: "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: "EmployeeRoles", columns: new[] { "Id", "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: "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: "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_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_EmployeeID", table: "AttendanceLogs", column: "EmployeeID"); migrationBuilder.CreateIndex( name: "IX_AttendanceLogs_TenantId", table: "AttendanceLogs", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_Attendances_EmployeeID", table: "Attendances", column: "EmployeeID"); migrationBuilder.CreateIndex( name: "IX_Attendances_InTimeID", table: "Attendances", column: "InTimeID"); migrationBuilder.CreateIndex( name: "IX_Attendances_OutTimeID", table: "Attendances", column: "OutTimeID"); migrationBuilder.CreateIndex( name: "IX_Attendances_TenantId", table: "Attendances", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_Buildings_TenantId", table: "Buildings", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_EmployeeRoles_TenantId", table: "EmployeeRoles", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_Employees_ApplicationUserId", table: "Employees", column: "ApplicationUserId"); migrationBuilder.CreateIndex( name: "IX_Employees_RoleId", table: "Employees", column: "RoleId"); migrationBuilder.CreateIndex( name: "IX_Employees_TenantId", table: "Employees", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_Feature_TenantId", table: "Feature", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_FeaturePermission_FeatureId", table: "FeaturePermission", column: "FeatureId"); migrationBuilder.CreateIndex( name: "IX_FeaturePermission_RoleId", table: "FeaturePermission", column: "RoleId"); migrationBuilder.CreateIndex( name: "IX_FeaturePermission_TenantId", table: "FeaturePermission", column: "TenantId"); migrationBuilder.CreateIndex( name: "IX_Floor_BuildingId", table: "Floor", column: "BuildingId"); migrationBuilder.CreateIndex( name: "IX_Floor_TenantId", table: "Floor", 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_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"); } /// 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: "Attendances"); migrationBuilder.DropTable( name: "FeaturePermission"); migrationBuilder.DropTable( name: "ProjectAllocations"); migrationBuilder.DropTable( name: "RefreshTokens"); migrationBuilder.DropTable( name: "WorkItemMapping"); migrationBuilder.DropTable( name: "WorkShifts"); migrationBuilder.DropTable( name: "AspNetRoles"); migrationBuilder.DropTable( name: "AttendanceLogs"); migrationBuilder.DropTable( name: "Feature"); migrationBuilder.DropTable( name: "WorkItems"); migrationBuilder.DropTable( name: "ActivityMasters"); migrationBuilder.DropTable( name: "TaskAllocations"); migrationBuilder.DropTable( name: "Employees"); migrationBuilder.DropTable( name: "Projects"); migrationBuilder.DropTable( name: "WorkAreas"); migrationBuilder.DropTable( name: "AspNetUsers"); migrationBuilder.DropTable( name: "EmployeeRoles"); migrationBuilder.DropTable( name: "StatusMasters"); migrationBuilder.DropTable( name: "Floor"); migrationBuilder.DropTable( name: "Buildings"); migrationBuilder.DropTable( name: "Tenants"); } } }