//
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using mws.backend.dotnet.infrastructure.Persistence;
#nullable disable
namespace mws.backend.dotnet.infrastructure.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20260912132858_InitialCreate")]
partial class InitialCreate
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("mws.backend.dotnet.domain.Documents.Document", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("ContentHash")
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("ContentSize")
.HasColumnType("bigint");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("ParentId")
.HasColumnType("uuid");
b.Property("ProjectId")
.HasColumnType("uuid");
b.Property("StorageKey")
.HasMaxLength(512)
.HasColumnType("character varying(512)");
b.Property("Title")
.IsRequired()
.HasMaxLength(300)
.HasColumnType("character varying(300)");
b.Property("Type")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.Property("UpdatedContentAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ParentId");
b.HasIndex("ProjectId", "ParentId");
b.ToTable("documents", (string)null);
});
modelBuilder.Entity("mws.backend.dotnet.domain.MasterData.MasterDataEntry", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("Group")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("IsActive")
.HasColumnType("boolean");
b.Property("Label")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property("SortOrder")
.HasColumnType("integer");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("Value")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.HasKey("Id");
b.HasIndex("Group", "Value")
.IsUnique();
b.ToTable("master_data", (string)null);
});
modelBuilder.Entity("mws.backend.dotnet.domain.Projects.Project", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("Description")
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.Property("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property("Status")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("CreatedBy");
b.HasIndex("UpdatedBy");
b.ToTable("projects", (string)null);
});
modelBuilder.Entity("mws.backend.dotnet.domain.Projects.ProjectMember", b =>
{
b.Property("ProjectId")
.HasColumnType("uuid");
b.Property("UserId")
.HasColumnType("uuid");
b.Property("Role")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.HasKey("ProjectId", "UserId");
b.HasIndex("UserId");
b.ToTable("project_members", (string)null);
});
modelBuilder.Entity("mws.backend.dotnet.domain.Projects.ProjectMemberPermission", b =>
{
b.Property("ProjectId")
.HasColumnType("uuid");
b.Property("UserId")
.HasColumnType("uuid");
b.Property("Screen")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("CanCreate")
.HasColumnType("boolean");
b.Property("CanDelete")
.HasColumnType("boolean");
b.Property("CanEdit")
.HasColumnType("boolean");
b.Property("CanView")
.HasColumnType("boolean");
b.HasKey("ProjectId", "UserId", "Screen");
b.ToTable("project_member_permissions", (string)null);
});
modelBuilder.Entity("mws.backend.dotnet.domain.Roles.Role", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("IsSystem")
.HasColumnType("boolean");
b.Property("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("roles", (string)null);
});
modelBuilder.Entity("mws.backend.dotnet.domain.Roles.RolePermission", b =>
{
b.Property("RoleId")
.HasColumnType("uuid");
b.Property("Screen")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property("CanCreate")
.HasColumnType("boolean");
b.Property("CanDelete")
.HasColumnType("boolean");
b.Property("CanEdit")
.HasColumnType("boolean");
b.Property("CanView")
.HasColumnType("boolean");
b.HasKey("RoleId", "Screen");
b.ToTable("role_permissions", (string)null);
});
modelBuilder.Entity("mws.backend.dotnet.domain.Tasks.TaskItem", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("AssigneeId")
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("Description")
.HasColumnType("text");
b.Property("DueDate")
.HasColumnType("timestamp with time zone");
b.Property("Priority")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.Property("ProjectId")
.HasColumnType("uuid");
b.Property("Status")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.Property("Title")
.IsRequired()
.HasMaxLength(300)
.HasColumnType("character varying(300)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("AssigneeId");
b.HasIndex("ProjectId");
b.HasIndex("Status");
b.ToTable("tasks", (string)null);
});
modelBuilder.Entity("mws.backend.dotnet.domain.Users.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("DisplayName")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("character varying(150)");
b.Property("IsActive")
.HasColumnType("boolean");
b.Property("PasswordHash")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("Username")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.HasKey("Id");
b.HasIndex("Username")
.IsUnique();
b.ToTable("users", (string)null);
});
modelBuilder.Entity("mws.backend.dotnet.domain.Users.UserRole", b =>
{
b.Property("UserId")
.HasColumnType("uuid");
b.Property("RoleId")
.HasColumnType("uuid");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("user_roles", (string)null);
});
modelBuilder.Entity("mws.backend.dotnet.domain.Documents.Document", b =>
{
b.HasOne("mws.backend.dotnet.domain.Documents.Document", "Parent")
.WithMany("Children")
.HasForeignKey("ParentId")
.OnDelete(DeleteBehavior.Restrict);
b.Navigation("Parent");
});
modelBuilder.Entity("mws.backend.dotnet.domain.Projects.Project", b =>
{
b.HasOne("mws.backend.dotnet.domain.Users.User", "CreatedByUser")
.WithMany()
.HasForeignKey("CreatedBy")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("mws.backend.dotnet.domain.Users.User", "UpdatedByUser")
.WithMany()
.HasForeignKey("UpdatedBy")
.OnDelete(DeleteBehavior.Restrict);
b.Navigation("CreatedByUser");
b.Navigation("UpdatedByUser");
});
modelBuilder.Entity("mws.backend.dotnet.domain.Projects.ProjectMember", b =>
{
b.HasOne("mws.backend.dotnet.domain.Projects.Project", "Project")
.WithMany("Members")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("mws.backend.dotnet.domain.Users.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Project");
b.Navigation("User");
});
modelBuilder.Entity("mws.backend.dotnet.domain.Projects.ProjectMemberPermission", b =>
{
b.HasOne("mws.backend.dotnet.domain.Projects.ProjectMember", null)
.WithMany()
.HasForeignKey("ProjectId", "UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("mws.backend.dotnet.domain.Roles.RolePermission", b =>
{
b.HasOne("mws.backend.dotnet.domain.Roles.Role", "Role")
.WithMany("Permissions")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Role");
});
modelBuilder.Entity("mws.backend.dotnet.domain.Tasks.TaskItem", b =>
{
b.HasOne("mws.backend.dotnet.domain.Users.User", "Assignee")
.WithMany()
.HasForeignKey("AssigneeId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Assignee");
});
modelBuilder.Entity("mws.backend.dotnet.domain.Users.UserRole", b =>
{
b.HasOne("mws.backend.dotnet.domain.Roles.Role", "Role")
.WithMany("UserRoles")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("mws.backend.dotnet.domain.Users.User", "User")
.WithMany("UserRoles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Role");
b.Navigation("User");
});
modelBuilder.Entity("mws.backend.dotnet.domain.Documents.Document", b =>
{
b.Navigation("Children");
});
modelBuilder.Entity("mws.backend.dotnet.domain.Projects.Project", b =>
{
b.Navigation("Members");
});
modelBuilder.Entity("mws.backend.dotnet.domain.Roles.Role", b =>
{
b.Navigation("Permissions");
b.Navigation("UserRoles");
});
modelBuilder.Entity("mws.backend.dotnet.domain.Users.User", b =>
{
b.Navigation("UserRoles");
});
#pragma warning restore 612, 618
}
}
}