//
using System;
using AMREZ.EOP.Infrastructures.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace AMREZ.EOP.Infrastructures.Migrations
{
[DbContext(typeof(AppDbContext))]
partial class AppDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.Permission", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Code")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at")
.HasDefaultValueSql("now() at time zone 'utc'");
b.Property("CreatedBy")
.HasColumnType("text")
.HasColumnName("created_by");
b.Property("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasColumnName("is_deleted");
b.Property("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("TenantId")
.HasColumnType("uuid")
.HasColumnName("tenant_id");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property("UpdatedBy")
.HasColumnType("text")
.HasColumnName("updated_by");
b.HasKey("Id");
b.HasIndex("TenantId");
b.HasIndex("TenantId", "Code")
.IsUnique();
b.ToTable("permissions", null, t =>
{
t.HasCheckConstraint("ck_permissions_tenant_not_null", "tenant_id is not null");
t.HasCheckConstraint("ck_permissions_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'");
});
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.Role", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Code")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at")
.HasDefaultValueSql("now() at time zone 'utc'");
b.Property("CreatedBy")
.HasColumnType("text")
.HasColumnName("created_by");
b.Property("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasColumnName("is_deleted");
b.Property("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("TenantId")
.HasColumnType("uuid")
.HasColumnName("tenant_id");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property("UpdatedBy")
.HasColumnType("text")
.HasColumnName("updated_by");
b.HasKey("Id");
b.HasIndex("TenantId");
b.HasIndex("TenantId", "Code")
.IsUnique();
b.ToTable("roles", null, t =>
{
t.HasCheckConstraint("ck_roles_tenant_not_null", "tenant_id is not null");
t.HasCheckConstraint("ck_roles_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'");
});
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.RolePermission", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at")
.HasDefaultValueSql("now() at time zone 'utc'");
b.Property("CreatedBy")
.HasColumnType("text")
.HasColumnName("created_by");
b.Property("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasColumnName("is_deleted");
b.Property("PermissionId")
.HasColumnType("uuid");
b.Property("RoleId")
.HasColumnType("uuid");
b.Property("TenantId")
.HasColumnType("uuid")
.HasColumnName("tenant_id");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property("UpdatedBy")
.HasColumnType("text")
.HasColumnName("updated_by");
b.HasKey("Id");
b.HasIndex("PermissionId");
b.HasIndex("RoleId");
b.HasIndex("TenantId");
b.HasIndex("TenantId", "PermissionId");
b.HasIndex("TenantId", "RoleId", "PermissionId")
.IsUnique();
b.ToTable("role_permissions", null, t =>
{
t.HasCheckConstraint("ck_role_permissions_tenant_not_null", "tenant_id is not null");
t.HasCheckConstraint("ck_role_permissions_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'");
});
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("AccessFailedCount")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(0);
b.Property("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at")
.HasDefaultValueSql("now() at time zone 'utc'");
b.Property("CreatedBy")
.HasColumnType("text")
.HasColumnName("created_by");
b.Property("IsActive")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(true);
b.Property("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasColumnName("is_deleted");
b.Property("LockoutEndUtc")
.HasColumnType("timestamp with time zone");
b.Property("MfaEnabled")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false);
b.Property("PasswordHash")
.IsRequired()
.HasColumnType("text");
b.Property("SecurityStamp")
.HasColumnType("text");
b.Property("TenantId")
.HasColumnType("uuid")
.HasColumnName("tenant_id");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property("UpdatedBy")
.HasColumnType("text")
.HasColumnName("updated_by");
b.HasKey("Id");
b.HasIndex("TenantId");
b.ToTable("users", null, t =>
{
t.HasCheckConstraint("ck_users_tenant_not_null", "tenant_id is not null");
t.HasCheckConstraint("ck_users_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'");
});
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserExternalAccount", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at")
.HasDefaultValueSql("now() at time zone 'utc'");
b.Property("CreatedBy")
.HasColumnType("text")
.HasColumnName("created_by");
b.Property("Email")
.HasColumnType("text");
b.Property("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasColumnName("is_deleted");
b.Property("LinkedAt")
.HasColumnType("timestamp with time zone");
b.Property("Provider")
.HasColumnType("integer");
b.Property("Subject")
.IsRequired()
.HasColumnType("text");
b.Property("TenantId")
.HasColumnType("uuid")
.HasColumnName("tenant_id");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property("UpdatedBy")
.HasColumnType("text")
.HasColumnName("updated_by");
b.Property("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TenantId");
b.HasIndex("TenantId", "UserId");
b.HasIndex("TenantId", "Provider", "Subject")
.IsUnique();
b.ToTable("user_external_accounts", null, t =>
{
t.HasCheckConstraint("ck_user_external_accounts_tenant_not_null", "tenant_id is not null");
t.HasCheckConstraint("ck_user_external_accounts_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'");
});
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserIdentity", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at")
.HasDefaultValueSql("now() at time zone 'utc'");
b.Property("CreatedBy")
.HasColumnType("text")
.HasColumnName("created_by");
b.Property("Identifier")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasColumnName("is_deleted");
b.Property("IsPrimary")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false);
b.Property("TenantId")
.HasColumnType("uuid")
.HasColumnName("tenant_id");
b.Property("Type")
.HasColumnType("integer");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property("UpdatedBy")
.HasColumnType("text")
.HasColumnName("updated_by");
b.Property("UserId")
.HasColumnType("uuid");
b.Property("VerifiedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("TenantId");
b.HasIndex("TenantId", "Type", "Identifier")
.IsUnique();
b.HasIndex("TenantId", "UserId", "Type", "IsPrimary")
.HasDatabaseName("ix_user_identity_primary_per_type");
b.ToTable("user_identities", null, t =>
{
t.HasCheckConstraint("ck_user_identities_tenant_not_null", "tenant_id is not null");
t.HasCheckConstraint("ck_user_identities_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'");
});
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserMfaFactor", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("AddedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at")
.HasDefaultValueSql("now() at time zone 'utc'");
b.Property("CreatedBy")
.HasColumnType("text")
.HasColumnName("created_by");
b.Property("CredentialId")
.HasColumnType("text");
b.Property("Email")
.HasColumnType("text");
b.Property("Enabled")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(true);
b.Property("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasColumnName("is_deleted");
b.Property("Label")
.HasColumnType("text");
b.Property("LastUsedAt")
.HasColumnType("timestamp with time zone");
b.Property("PhoneE164")
.HasColumnType("text");
b.Property("PublicKey")
.HasColumnType("text");
b.Property("Secret")
.HasColumnType("text");
b.Property("TenantId")
.HasColumnType("uuid")
.HasColumnName("tenant_id");
b.Property("Type")
.HasColumnType("integer");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property("UpdatedBy")
.HasColumnType("text")
.HasColumnName("updated_by");
b.Property("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TenantId");
b.HasIndex("TenantId", "UserId");
b.ToTable("user_mfa_factors", null, t =>
{
t.HasCheckConstraint("ck_user_mfa_factors_tenant_not_null", "tenant_id is not null");
t.HasCheckConstraint("ck_user_mfa_factors_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'");
});
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserPasswordHistory", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("ChangedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at")
.HasDefaultValueSql("now() at time zone 'utc'");
b.Property("CreatedBy")
.HasColumnType("text")
.HasColumnName("created_by");
b.Property("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasColumnName("is_deleted");
b.Property("PasswordHash")
.IsRequired()
.HasColumnType("text");
b.Property("TenantId")
.HasColumnType("uuid")
.HasColumnName("tenant_id");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property("UpdatedBy")
.HasColumnType("text")
.HasColumnName("updated_by");
b.Property("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TenantId");
b.HasIndex("TenantId", "UserId", "ChangedAt");
b.ToTable("user_password_histories", null, t =>
{
t.HasCheckConstraint("ck_user_password_histories_tenant_not_null", "tenant_id is not null");
t.HasCheckConstraint("ck_user_password_histories_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'");
});
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserRole", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at")
.HasDefaultValueSql("now() at time zone 'utc'");
b.Property("CreatedBy")
.HasColumnType("text")
.HasColumnName("created_by");
b.Property("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasColumnName("is_deleted");
b.Property("RoleId")
.HasColumnType("uuid");
b.Property("TenantId")
.HasColumnType("uuid")
.HasColumnName("tenant_id");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property("UpdatedBy")
.HasColumnType("text")
.HasColumnName("updated_by");
b.Property("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("RoleId");
b.HasIndex("TenantId");
b.HasIndex("UserId");
b.HasIndex("TenantId", "RoleId");
b.HasIndex("TenantId", "UserId", "RoleId")
.IsUnique();
b.ToTable("user_roles", null, t =>
{
t.HasCheckConstraint("ck_user_roles_tenant_not_null", "tenant_id is not null");
t.HasCheckConstraint("ck_user_roles_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'");
});
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserSession", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at")
.HasDefaultValueSql("now() at time zone 'utc'");
b.Property("CreatedBy")
.HasColumnType("text")
.HasColumnName("created_by");
b.Property("DeviceId")
.HasColumnType("text");
b.Property("ExpiresAt")
.HasColumnType("timestamp with time zone");
b.Property("IpAddress")
.HasColumnType("text");
b.Property("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasColumnName("is_deleted");
b.Property("IssuedAt")
.HasColumnType("timestamp with time zone");
b.Property("RefreshTokenHash")
.IsRequired()
.HasColumnType("text");
b.Property("RevokedAt")
.HasColumnType("timestamp with time zone");
b.Property("TenantId")
.HasColumnType("uuid")
.HasColumnName("tenant_id");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property("UpdatedBy")
.HasColumnType("text")
.HasColumnName("updated_by");
b.Property("UserAgent")
.HasColumnType("text");
b.Property("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TenantId");
b.HasIndex("TenantId", "DeviceId");
b.HasIndex("TenantId", "UserId");
b.ToTable("user_sessions", null, t =>
{
t.HasCheckConstraint("ck_user_sessions_tenant_not_null", "tenant_id is not null");
t.HasCheckConstraint("ck_user_sessions_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'");
});
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.Department", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Code")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at")
.HasDefaultValueSql("now() at time zone 'utc'");
b.Property("CreatedBy")
.HasColumnType("text")
.HasColumnName("created_by");
b.Property("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasColumnName("is_deleted");
b.Property("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("ParentDepartmentId")
.HasColumnType("uuid");
b.Property("TenantId")
.HasColumnType("uuid")
.HasColumnName("tenant_id");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property("UpdatedBy")
.HasColumnType("text")
.HasColumnName("updated_by");
b.HasKey("Id");
b.HasIndex("TenantId");
b.HasIndex("TenantId", "Code")
.IsUnique();
b.HasIndex("TenantId", "ParentDepartmentId");
b.ToTable("departments", null, t =>
{
t.HasCheckConstraint("ck_departments_tenant_not_null", "tenant_id is not null");
t.HasCheckConstraint("ck_departments_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'");
});
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.EmergencyContact", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at")
.HasDefaultValueSql("now() at time zone 'utc'");
b.Property("CreatedBy")
.HasColumnType("text")
.HasColumnName("created_by");
b.Property("Email")
.HasColumnType("text");
b.Property("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasColumnName("is_deleted");
b.Property("IsPrimary")
.HasColumnType("boolean");
b.Property("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("Phone")
.HasColumnType("text");
b.Property("Relationship")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("TenantId")
.HasColumnType("uuid")
.HasColumnName("tenant_id");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property("UpdatedBy")
.HasColumnType("text")
.HasColumnName("updated_by");
b.Property("UserProfileId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TenantId");
b.HasIndex("TenantId", "UserProfileId", "IsPrimary");
b.ToTable("emergency_contacts", null, t =>
{
t.HasCheckConstraint("ck_emergency_contacts_tenant_not_null", "tenant_id is not null");
t.HasCheckConstraint("ck_emergency_contacts_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'");
});
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.EmployeeAddress", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("City")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("Country")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at")
.HasDefaultValueSql("now() at time zone 'utc'");
b.Property("CreatedBy")
.HasColumnType("text")
.HasColumnName("created_by");
b.Property("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasColumnName("is_deleted");
b.Property("IsPrimary")
.HasColumnType("boolean");
b.Property("Line1")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("Line2")
.HasColumnType("text");
b.Property("PostalCode")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property("State")
.HasColumnType("text");
b.Property("TenantId")
.HasColumnType("uuid")
.HasColumnName("tenant_id");
b.Property("Type")
.HasColumnType("integer");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property("UpdatedBy")
.HasColumnType("text")
.HasColumnName("updated_by");
b.Property("UserProfileId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TenantId");
b.HasIndex("TenantId", "UserProfileId", "IsPrimary");
b.ToTable("employee_addresses", null, t =>
{
t.HasCheckConstraint("ck_employee_addresses_tenant_not_null", "tenant_id is not null");
t.HasCheckConstraint("ck_employee_addresses_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'");
});
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.EmployeeBankAccount", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("AccountHolder")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("AccountNumber")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("BankName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("Branch")
.HasColumnType("text");
b.Property("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at")
.HasDefaultValueSql("now() at time zone 'utc'");
b.Property("CreatedBy")
.HasColumnType("text")
.HasColumnName("created_by");
b.Property("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasColumnName("is_deleted");
b.Property("IsPrimary")
.HasColumnType("boolean");
b.Property("Note")
.HasColumnType("text");
b.Property("TenantId")
.HasColumnType("uuid")
.HasColumnName("tenant_id");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property("UpdatedBy")
.HasColumnType("text")
.HasColumnName("updated_by");
b.Property("UserProfileId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TenantId");
b.HasIndex("TenantId", "UserProfileId", "IsPrimary");
b.ToTable("employee_bank_accounts", null, t =>
{
t.HasCheckConstraint("ck_employee_bank_accounts_tenant_not_null", "tenant_id is not null");
t.HasCheckConstraint("ck_employee_bank_accounts_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'");
});
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.Employment", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at")
.HasDefaultValueSql("now() at time zone 'utc'");
b.Property("CreatedBy")
.HasColumnType("text")
.HasColumnName("created_by");
b.Property("DepartmentId")
.HasColumnType("uuid");
b.Property("EmploymentType")
.HasColumnType("integer");
b.Property("EndDate")
.HasColumnType("timestamp with time zone");
b.Property("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasColumnName("is_deleted");
b.Property("ManagerUserId")
.HasColumnType("uuid");
b.Property("PositionId")
.HasColumnType("uuid");
b.Property("StartDate")
.HasColumnType("timestamp with time zone");
b.Property("TenantId")
.HasColumnType("uuid")
.HasColumnName("tenant_id");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property("UpdatedBy")
.HasColumnType("text")
.HasColumnName("updated_by");
b.Property("UserProfileId")
.HasColumnType("uuid");
b.Property("WorkEmail")
.HasColumnType("text");
b.Property("WorkPhone")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("TenantId");
b.HasIndex("TenantId", "DepartmentId");
b.HasIndex("TenantId", "PositionId");
b.HasIndex("TenantId", "UserProfileId", "StartDate");
b.ToTable("employments", null, t =>
{
t.HasCheckConstraint("ck_employments_tenant_not_null", "tenant_id is not null");
t.HasCheckConstraint("ck_employments_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'");
});
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.Position", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Code")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at")
.HasDefaultValueSql("now() at time zone 'utc'");
b.Property("CreatedBy")
.HasColumnType("text")
.HasColumnName("created_by");
b.Property("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasColumnName("is_deleted");
b.Property("Level")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("uuid")
.HasColumnName("tenant_id");
b.Property("Title")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property("UpdatedBy")
.HasColumnType("text")
.HasColumnName("updated_by");
b.HasKey("Id");
b.HasIndex("TenantId");
b.HasIndex("TenantId", "Code")
.IsUnique();
b.ToTable("positions", null, t =>
{
t.HasCheckConstraint("ck_positions_tenant_not_null", "tenant_id is not null");
t.HasCheckConstraint("ck_positions_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'");
});
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.UserProfile", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at")
.HasDefaultValueSql("now() at time zone 'utc'");
b.Property("CreatedBy")
.HasColumnType("text")
.HasColumnName("created_by");
b.Property("DateOfBirth")
.HasColumnType("timestamp with time zone");
b.Property("DepartmentId")
.HasColumnType("uuid");
b.Property("FirstName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("Gender")
.HasColumnType("integer");
b.Property("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasColumnName("is_deleted");
b.Property("LastName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("MiddleName")
.HasColumnType("text");
b.Property("Nickname")
.HasColumnType("text");
b.Property("PositionId")
.HasColumnType("uuid");
b.Property("TenantId")
.HasColumnType("uuid")
.HasColumnName("tenant_id");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property("UpdatedBy")
.HasColumnType("text")
.HasColumnName("updated_by");
b.Property("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("DepartmentId");
b.HasIndex("PositionId");
b.HasIndex("TenantId");
b.HasIndex("TenantId", "UserId")
.IsUnique();
b.ToTable("user_profiles", null, t =>
{
t.HasCheckConstraint("ck_user_profiles_tenant_not_null", "tenant_id is not null");
t.HasCheckConstraint("ck_user_profiles_tenant_not_zero", "tenant_id <> '00000000-0000-0000-0000-000000000000'");
});
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Tenancy.TenantConfig", b =>
{
b.Property("TenantKey")
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("ConnectionString")
.HasColumnType("text");
b.Property("IsActive")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(true);
b.Property("Mode")
.HasColumnType("integer");
b.Property("Schema")
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("TenantId")
.HasColumnType("uuid");
b.Property("UpdatedAtUtc")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at_utc")
.HasDefaultValueSql("now() at time zone 'utc'");
b.HasKey("TenantKey");
b.HasAlternateKey("TenantId");
b.HasIndex("IsActive");
b.HasIndex("TenantId")
.IsUnique();
b.ToTable("tenants", "meta");
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Tenancy.TenantDomain", b =>
{
b.Property("Domain")
.HasMaxLength(253)
.HasColumnType("character varying(253)");
b.Property("IsActive")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(true);
b.Property("IsPlatformBaseDomain")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false);
b.Property("TenantKey")
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("UpdatedAtUtc")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at_utc")
.HasDefaultValueSql("now() at time zone 'utc'");
b.HasKey("Domain");
b.HasIndex("IsActive");
b.HasIndex("IsPlatformBaseDomain");
b.HasIndex("TenantKey");
b.ToTable("tenant_domains", "meta");
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.RolePermission", b =>
{
b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.Permission", "Permission")
.WithMany("RolePermissions")
.HasForeignKey("PermissionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.Role", "Role")
.WithMany("RolePermissions")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.Permission", null)
.WithMany()
.HasForeignKey("TenantId", "PermissionId")
.HasPrincipalKey("TenantId", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.Role", null)
.WithMany()
.HasForeignKey("TenantId", "RoleId")
.HasPrincipalKey("TenantId", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Permission");
b.Navigation("Role");
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserExternalAccount", b =>
{
b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.User", "User")
.WithMany("ExternalAccounts")
.HasForeignKey("TenantId", "UserId")
.HasPrincipalKey("TenantId", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserIdentity", b =>
{
b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.User", "User")
.WithMany("Identities")
.HasForeignKey("TenantId", "UserId")
.HasPrincipalKey("TenantId", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserMfaFactor", b =>
{
b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.User", "User")
.WithMany("MfaFactors")
.HasForeignKey("TenantId", "UserId")
.HasPrincipalKey("TenantId", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserPasswordHistory", b =>
{
b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.User", "User")
.WithMany("PasswordHistories")
.HasForeignKey("TenantId", "UserId")
.HasPrincipalKey("TenantId", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserRole", b =>
{
b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.Role", "Role")
.WithMany("UserRoles")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.User", "User")
.WithMany("UserRoles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.Role", null)
.WithMany()
.HasForeignKey("TenantId", "RoleId")
.HasPrincipalKey("TenantId", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.User", null)
.WithMany()
.HasForeignKey("TenantId", "UserId")
.HasPrincipalKey("TenantId", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Role");
b.Navigation("User");
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.UserSession", b =>
{
b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.User", "User")
.WithMany("Sessions")
.HasForeignKey("TenantId", "UserId")
.HasPrincipalKey("TenantId", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.Department", b =>
{
b.HasOne("AMREZ.EOP.Domain.Entities.HumanResources.Department", "Parent")
.WithMany("Children")
.HasForeignKey("TenantId", "ParentDepartmentId")
.HasPrincipalKey("TenantId", "Id")
.OnDelete(DeleteBehavior.Restrict);
b.Navigation("Parent");
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.EmergencyContact", b =>
{
b.HasOne("AMREZ.EOP.Domain.Entities.HumanResources.UserProfile", "UserProfile")
.WithMany("EmergencyContacts")
.HasForeignKey("TenantId", "UserProfileId")
.HasPrincipalKey("TenantId", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("UserProfile");
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.EmployeeAddress", b =>
{
b.HasOne("AMREZ.EOP.Domain.Entities.HumanResources.UserProfile", "UserProfile")
.WithMany("Addresses")
.HasForeignKey("TenantId", "UserProfileId")
.HasPrincipalKey("TenantId", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("UserProfile");
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.EmployeeBankAccount", b =>
{
b.HasOne("AMREZ.EOP.Domain.Entities.HumanResources.UserProfile", "UserProfile")
.WithMany("BankAccounts")
.HasForeignKey("TenantId", "UserProfileId")
.HasPrincipalKey("TenantId", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("UserProfile");
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.Employment", b =>
{
b.HasOne("AMREZ.EOP.Domain.Entities.HumanResources.Department", "Department")
.WithMany()
.HasForeignKey("TenantId", "DepartmentId")
.HasPrincipalKey("TenantId", "Id")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("AMREZ.EOP.Domain.Entities.HumanResources.Position", "Position")
.WithMany()
.HasForeignKey("TenantId", "PositionId")
.HasPrincipalKey("TenantId", "Id")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("AMREZ.EOP.Domain.Entities.HumanResources.UserProfile", "UserProfile")
.WithMany("Employments")
.HasForeignKey("TenantId", "UserProfileId")
.HasPrincipalKey("TenantId", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Department");
b.Navigation("Position");
b.Navigation("UserProfile");
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.UserProfile", b =>
{
b.HasOne("AMREZ.EOP.Domain.Entities.HumanResources.Department", null)
.WithMany("Profiles")
.HasForeignKey("DepartmentId");
b.HasOne("AMREZ.EOP.Domain.Entities.HumanResources.Position", null)
.WithMany("Profiles")
.HasForeignKey("PositionId");
b.HasOne("AMREZ.EOP.Domain.Entities.Authentications.User", "User")
.WithOne()
.HasForeignKey("AMREZ.EOP.Domain.Entities.HumanResources.UserProfile", "TenantId", "UserId")
.HasPrincipalKey("AMREZ.EOP.Domain.Entities.Authentications.User", "TenantId", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Tenancy.TenantDomain", b =>
{
b.HasOne("AMREZ.EOP.Domain.Entities.Tenancy.TenantConfig", null)
.WithMany()
.HasForeignKey("TenantKey")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.Permission", b =>
{
b.Navigation("RolePermissions");
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.Role", b =>
{
b.Navigation("RolePermissions");
b.Navigation("UserRoles");
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.Authentications.User", b =>
{
b.Navigation("ExternalAccounts");
b.Navigation("Identities");
b.Navigation("MfaFactors");
b.Navigation("PasswordHistories");
b.Navigation("Sessions");
b.Navigation("UserRoles");
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.Department", b =>
{
b.Navigation("Children");
b.Navigation("Profiles");
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.Position", b =>
{
b.Navigation("Profiles");
});
modelBuilder.Entity("AMREZ.EOP.Domain.Entities.HumanResources.UserProfile", b =>
{
b.Navigation("Addresses");
b.Navigation("BankAccounts");
b.Navigation("EmergencyContacts");
b.Navigation("Employments");
});
#pragma warning restore 612, 618
}
}
}