//
using System;
using System.Collections.Generic;
using DysonNetwork.Sphere;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using NodaTime;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
[DbContext(typeof(AppDatabase))]
[Migration("20250427161252_AddPermission")]
partial class AddPermission
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("DysonNetwork.Sphere.Account.Account", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at");
b.Property("IsSuperuser")
.HasColumnType("boolean")
.HasColumnName("is_superuser");
b.Property("Language")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("character varying(32)")
.HasColumnName("language");
b.Property("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasColumnName("name");
b.Property("Nick")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasColumnName("nick");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.HasKey("Id")
.HasName("pk_accounts");
b.HasIndex("Name")
.IsUnique()
.HasDatabaseName("ix_accounts_name");
b.ToTable("accounts", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountAuthFactor", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("AccountId")
.HasColumnType("bigint")
.HasColumnName("account_id");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at");
b.Property("Secret")
.HasColumnType("text")
.HasColumnName("secret");
b.Property("Type")
.HasColumnType("integer")
.HasColumnName("type");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.HasKey("Id")
.HasName("pk_account_auth_factors");
b.HasIndex("AccountId")
.HasDatabaseName("ix_account_auth_factors_account_id");
b.ToTable("account_auth_factors", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Account.AccountContact", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("AccountId")
.HasColumnType("bigint")
.HasColumnName("account_id");
b.Property("Content")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasColumnName("content");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at");
b.Property("Type")
.HasColumnType("integer")
.HasColumnName("type");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property("VerifiedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("verified_at");
b.HasKey("Id")
.HasName("pk_account_contacts");
b.HasIndex("AccountId")
.HasDatabaseName("ix_account_contacts_account_id");
b.ToTable("account_contacts", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Account.Notification", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasColumnName("id");
b.Property("AccountId")
.HasColumnType("bigint")
.HasColumnName("account_id");
b.Property("Content")
.HasMaxLength(4096)
.HasColumnType("character varying(4096)")
.HasColumnName("content");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at");
b.Property>("Meta")
.HasColumnType("jsonb")
.HasColumnName("meta");
b.Property("Priority")
.HasColumnType("integer")
.HasColumnName("priority");
b.Property("Subtitle")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)")
.HasColumnName("subtitle");
b.Property("Title")
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasColumnName("title");
b.Property("Topic")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasColumnName("topic");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property("ViewedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("viewed_at");
b.HasKey("Id")
.HasName("pk_notifications");
b.HasIndex("AccountId")
.HasDatabaseName("ix_notifications_account_id");
b.ToTable("notifications", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Account.NotificationPushSubscription", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasColumnName("id");
b.Property("AccountId")
.HasColumnType("bigint")
.HasColumnName("account_id");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at");
b.Property("DeviceId")
.IsRequired()
.HasMaxLength(4096)
.HasColumnType("character varying(4096)")
.HasColumnName("device_id");
b.Property("DeviceToken")
.IsRequired()
.HasMaxLength(4096)
.HasColumnType("character varying(4096)")
.HasColumnName("device_token");
b.Property("LastUsedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("last_used_at");
b.Property("Provider")
.HasColumnType("integer")
.HasColumnName("provider");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.HasKey("Id")
.HasName("pk_notification_push_subscriptions");
b.HasIndex("AccountId")
.HasDatabaseName("ix_notification_push_subscriptions_account_id");
b.HasIndex("DeviceId")
.IsUnique()
.HasDatabaseName("ix_notification_push_subscriptions_device_id");
b.HasIndex("DeviceToken")
.IsUnique()
.HasDatabaseName("ix_notification_push_subscriptions_device_token");
b.ToTable("notification_push_subscriptions", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Account.Profile", b =>
{
b.Property("Id")
.HasColumnType("bigint")
.HasColumnName("id");
b.Property("BackgroundId")
.HasColumnType("character varying(128)")
.HasColumnName("background_id");
b.Property("Bio")
.HasMaxLength(4096)
.HasColumnType("character varying(4096)")
.HasColumnName("bio");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at");
b.Property("FirstName")
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasColumnName("first_name");
b.Property("LastName")
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasColumnName("last_name");
b.Property("MiddleName")
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasColumnName("middle_name");
b.Property("PictureId")
.HasColumnType("character varying(128)")
.HasColumnName("picture_id");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.HasKey("Id")
.HasName("pk_account_profiles");
b.HasIndex("BackgroundId")
.HasDatabaseName("ix_account_profiles_background_id");
b.HasIndex("PictureId")
.HasDatabaseName("ix_account_profiles_picture_id");
b.ToTable("account_profiles", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Account.Relationship", b =>
{
b.Property("AccountId")
.HasColumnType("bigint")
.HasColumnName("account_id");
b.Property("RelatedId")
.HasColumnType("bigint")
.HasColumnName("related_id");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at");
b.Property("ExpiredAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("expired_at");
b.Property("Status")
.HasColumnType("integer")
.HasColumnName("status");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.HasKey("AccountId", "RelatedId")
.HasName("pk_account_relationships");
b.HasIndex("RelatedId")
.HasDatabaseName("ix_account_relationships_related_id");
b.ToTable("account_relationships", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Auth.Challenge", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasColumnName("id");
b.Property("AccountId")
.HasColumnType("bigint")
.HasColumnName("account_id");
b.Property>("Audiences")
.IsRequired()
.HasColumnType("jsonb")
.HasColumnName("audiences");
b.Property>("BlacklistFactors")
.IsRequired()
.HasColumnType("jsonb")
.HasColumnName("blacklist_factors");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at");
b.Property("DeviceId")
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasColumnName("device_id");
b.Property("ExpiredAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("expired_at");
b.Property("IpAddress")
.HasMaxLength(128)
.HasColumnType("character varying(128)")
.HasColumnName("ip_address");
b.Property("Nonce")
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasColumnName("nonce");
b.Property>("Scopes")
.IsRequired()
.HasColumnType("jsonb")
.HasColumnName("scopes");
b.Property("StepRemain")
.HasColumnType("integer")
.HasColumnName("step_remain");
b.Property("StepTotal")
.HasColumnType("integer")
.HasColumnName("step_total");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property("UserAgent")
.HasMaxLength(512)
.HasColumnType("character varying(512)")
.HasColumnName("user_agent");
b.HasKey("Id")
.HasName("pk_auth_challenges");
b.HasIndex("AccountId")
.HasDatabaseName("ix_auth_challenges_account_id");
b.ToTable("auth_challenges", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Auth.Session", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasColumnName("id");
b.Property("AccountId")
.HasColumnType("bigint")
.HasColumnName("account_id");
b.Property("ChallengeId")
.HasColumnType("uuid")
.HasColumnName("challenge_id");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at");
b.Property("ExpiredAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("expired_at");
b.Property("LastGrantedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("last_granted_at");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.HasKey("Id")
.HasName("pk_auth_sessions");
b.HasIndex("AccountId")
.HasDatabaseName("ix_auth_sessions_account_id");
b.HasIndex("ChallengeId")
.HasDatabaseName("ix_auth_sessions_challenge_id");
b.ToTable("auth_sessions", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasColumnName("id");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at");
b.Property("Key")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasColumnName("key");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.HasKey("Id")
.HasName("pk_permission_groups");
b.ToTable("permission_groups", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b =>
{
b.Property("GroupId")
.HasColumnType("uuid")
.HasColumnName("group_id");
b.Property("AccountId")
.HasColumnType("bigint")
.HasColumnName("account_id");
b.Property("AffectedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("affected_at");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at");
b.Property("ExpiredAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("expired_at");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.HasKey("GroupId", "AccountId")
.HasName("pk_permission_group_member");
b.HasIndex("AccountId")
.HasDatabaseName("ix_permission_group_member_account_id");
b.ToTable("permission_group_member", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionNode", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasColumnName("id");
b.Property("Actor")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasColumnName("actor");
b.Property("AffectedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("affected_at");
b.Property("Area")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasColumnName("area");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at");
b.Property("ExpiredAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("expired_at");
b.Property("GroupId")
.HasColumnType("uuid")
.HasColumnName("group_id");
b.Property("Key")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasColumnName("key");
b.Property("PermissionGroupId")
.HasColumnType("uuid")
.HasColumnName("permission_group_id");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.Property