// using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using PSTW_CentralSystem.DBContext; #nullable disable namespace PSTW_CentralSystem.Migrations { [DbContext(typeof(IdentityDBContext))] [Migration("20241206015840_Initiate")] partial class Initiate { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "8.0.11") .HasAnnotation("Relational:MaxIdentifierLength", 64); MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("int"); MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); b.Property("ClaimType") .HasColumnType("longtext"); b.Property("ClaimValue") .HasColumnType("longtext"); b.Property("RoleId") .HasColumnType("int"); b.HasKey("Id"); b.HasIndex("RoleId"); b.ToTable("AspNetRoleClaims", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("int"); MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); b.Property("ClaimType") .HasColumnType("longtext"); b.Property("ClaimValue") .HasColumnType("longtext"); b.Property("UserId") .HasColumnType("int"); b.HasKey("Id"); b.HasIndex("UserId"); b.ToTable("AspNetUserClaims", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { b.Property("LoginProvider") .HasColumnType("varchar(255)"); b.Property("ProviderKey") .HasColumnType("varchar(255)"); b.Property("ProviderDisplayName") .HasColumnType("longtext"); b.Property("UserId") .HasColumnType("int"); b.HasKey("LoginProvider", "ProviderKey"); b.HasIndex("UserId"); b.ToTable("AspNetUserLogins", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { b.Property("UserId") .HasColumnType("int"); b.Property("RoleId") .HasColumnType("int"); b.HasKey("UserId", "RoleId"); b.HasIndex("RoleId"); b.ToTable("AspNetUserRoles", (string)null); b.HasData( new { UserId = 1, RoleId = 1 }, new { UserId = 2, RoleId = 2 }); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { b.Property("UserId") .HasColumnType("int"); b.Property("LoginProvider") .HasColumnType("varchar(255)"); b.Property("Name") .HasColumnType("varchar(255)"); b.Property("Value") .HasColumnType("longtext"); b.HasKey("UserId", "LoginProvider", "Name"); b.ToTable("AspNetUserTokens", (string)null); }); modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b => { b.Property("CompanyId") .ValueGeneratedOnAdd() .HasColumnType("int"); MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CompanyId")); b.Property("CompanyName") .IsRequired() .HasColumnType("longtext"); b.HasKey("CompanyId"); b.ToTable("Companies"); }); modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b => { b.Property("DepartmentId") .ValueGeneratedOnAdd() .HasColumnType("int"); MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("DepartmentId")); b.Property("CompanyId") .HasColumnType("int"); b.Property("DepartmentCode") .IsRequired() .HasColumnType("longtext"); b.Property("DepartmentName") .IsRequired() .HasColumnType("longtext"); b.HasKey("DepartmentId"); b.HasIndex("CompanyId"); b.ToTable("Departments"); }); modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b => { b.Property("SettingId") .ValueGeneratedOnAdd() .HasColumnType("int"); MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SettingId")); b.Property("AllowedUserType") .HasColumnType("longtext"); b.Property("Description") .HasColumnType("longtext"); b.Property("MethodAllowedUserType") .HasColumnType("json"); b.Property("ModuleName") .IsRequired() .HasMaxLength(50) .HasColumnType("varchar(50)"); b.Property("ModuleStatus") .HasColumnType("int"); b.HasKey("SettingId"); b.ToTable("ModuleSettings"); }); modelBuilder.Entity("PSTW_CentralSystem.Models.RoleModel", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("int"); MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .HasColumnType("longtext"); b.Property("Description") .HasColumnType("longtext"); b.Property("Name") .HasMaxLength(256) .HasColumnType("varchar(256)"); b.Property("NormalizedName") .HasMaxLength(256) .HasColumnType("varchar(256)"); b.HasKey("Id"); b.HasIndex("NormalizedName") .IsUnique() .HasDatabaseName("RoleNameIndex"); b.ToTable("AspNetRoles", (string)null); b.HasData( new { Id = 1, Description = "Can access all pages", Name = "SuperAdmin", NormalizedName = "SUPERADMIN" }, new { Id = 2, Description = "Can access some admin pages", Name = "SystemAdmin", NormalizedName = "SYSTEMADMIN" }, new { Id = 3, Description = "Can access operation pages", Name = "Engineer", NormalizedName = "ENGINEER" }, new { Id = 4, Description = "Can access data viewer pages", Name = "Observer", NormalizedName = "OBSERVER" }); }); modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("int"); MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); b.Property("AccessFailedCount") .HasColumnType("int"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .HasColumnType("longtext"); b.Property("Email") .HasMaxLength(256) .HasColumnType("varchar(256)"); b.Property("EmailConfirmed") .HasColumnType("tinyint(1)"); b.Property("FullName") .HasColumnType("longtext"); b.Property("LockoutEnabled") .HasColumnType("tinyint(1)"); b.Property("LockoutEnd") .HasColumnType("datetime(6)"); b.Property("NormalizedEmail") .HasMaxLength(256) .HasColumnType("varchar(256)"); b.Property("NormalizedUserName") .HasMaxLength(256) .HasColumnType("varchar(256)"); b.Property("PasswordHash") .HasColumnType("longtext"); b.Property("PhoneNumber") .HasColumnType("longtext"); b.Property("PhoneNumberConfirmed") .HasColumnType("tinyint(1)"); b.Property("SecurityStamp") .HasColumnType("longtext"); b.Property("TwoFactorEnabled") .HasColumnType("tinyint(1)"); b.Property("UserName") .HasMaxLength(256) .HasColumnType("varchar(256)"); b.Property("UserStatus") .HasColumnType("int"); b.Property("departmentId") .HasColumnType("int"); b.HasKey("Id"); b.HasIndex("NormalizedEmail") .HasDatabaseName("EmailIndex"); b.HasIndex("NormalizedUserName") .IsUnique() .HasDatabaseName("UserNameIndex"); b.HasIndex("departmentId"); b.ToTable("AspNetUsers", (string)null); b.HasData( new { Id = 1, AccessFailedCount = 0, ConcurrencyStamp = "b58597b6-2835-4ff6-b437-11ec7a213434", Email = "admin@pstw.com.my", EmailConfirmed = true, FullName = "MAAdmin", LockoutEnabled = false, NormalizedEmail = "ADMIN@PSTW.COM.MY", NormalizedUserName = "ADMIN@PSTW.COM.MY", PasswordHash = "AQAAAAIAAYagAAAAECA03al9kGFTKlmmTls3wiH4NV7HlL76680Qx6lR7d77LHJwIN6/Wt1MBCP9TE1qfg==", PhoneNumberConfirmed = false, SecurityStamp = "0f649a27-6566-436c-bc27-d1a6b8e7f846", TwoFactorEnabled = false, UserName = "admin@pstw.com.my" }, new { Id = 2, AccessFailedCount = 0, ConcurrencyStamp = "cf9424fc-8afc-4f59-a0a6-34574676273c", Email = "sysadmin@pstw.com.my", EmailConfirmed = true, FullName = "SysAdmin", LockoutEnabled = false, NormalizedEmail = "SYSADMIN@PSTW.COM.MY", NormalizedUserName = "SYSADMIN@PSTW.COM.MY", PasswordHash = "AQAAAAIAAYagAAAAEMkwXv250FjOjdLEAY2a/aEF3g3iu9xCVORV/MH37kVcj8vgJez+LlfJtjklaschLg==", PhoneNumberConfirmed = false, SecurityStamp = "8efe9683-78fb-404d-96a9-b8b7302c03b2", TwoFactorEnabled = false, UserName = "sysadmin@pstw.com.my" }); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.HasOne("PSTW_CentralSystem.Models.RoleModel", null) .WithMany() .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { b.HasOne("PSTW_CentralSystem.Models.UserModel", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { b.HasOne("PSTW_CentralSystem.Models.UserModel", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { b.HasOne("PSTW_CentralSystem.Models.RoleModel", null) .WithMany() .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PSTW_CentralSystem.Models.UserModel", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { b.HasOne("PSTW_CentralSystem.Models.UserModel", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b => { b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company") .WithMany("Departments") .HasForeignKey("CompanyId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Company"); }); modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b => { b.HasOne("PSTW_CentralSystem.Models.DepartmentModel", "Department") .WithMany() .HasForeignKey("departmentId"); b.Navigation("Department"); }); modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b => { b.Navigation("Departments"); }); #pragma warning restore 612, 618 } } }