// using System; using Foxchat.Identity.Database; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace Foxchat.Identity.Migrations { [DbContext(typeof(IdentityContext))] [Migration("20240512225835_Init")] partial class Init { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "8.0.4") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("AccountChatInstance", b => { b.Property("AccountsId") .HasColumnType("uuid") .HasColumnName("accounts_id"); b.Property("ChatInstancesId") .HasColumnType("uuid") .HasColumnName("chat_instances_id"); b.HasKey("AccountsId", "ChatInstancesId") .HasName("pk_account_chat_instance"); b.HasIndex("ChatInstancesId") .HasDatabaseName("ix_account_chat_instance_chat_instances_id"); b.ToTable("account_chat_instance", (string)null); }); modelBuilder.Entity("Foxchat.Core.Database.Instance", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasColumnName("id"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("PrivateKey") .IsRequired() .HasColumnType("text") .HasColumnName("private_key"); b.Property("PublicKey") .IsRequired() .HasColumnType("text") .HasColumnName("public_key"); b.HasKey("Id") .HasName("pk_instance"); b.ToTable("instance", (string)null); }); modelBuilder.Entity("Foxchat.Identity.Database.Models.Account", b => { b.Property("Id") .HasColumnType("uuid") .HasColumnName("id"); b.Property("Avatar") .HasColumnType("text") .HasColumnName("avatar"); b.Property("Email") .IsRequired() .HasColumnType("text") .HasColumnName("email"); b.Property("Password") .IsRequired() .HasColumnType("text") .HasColumnName("password"); b.Property("Role") .HasColumnType("integer") .HasColumnName("role"); b.Property("Username") .IsRequired() .HasColumnType("text") .HasColumnName("username"); b.HasKey("Id") .HasName("pk_accounts"); b.HasIndex("Email") .IsUnique() .HasDatabaseName("ix_accounts_email"); b.HasIndex("Username") .IsUnique() .HasDatabaseName("ix_accounts_username"); b.ToTable("accounts", (string)null); }); modelBuilder.Entity("Foxchat.Identity.Database.Models.ChatInstance", b => { b.Property("Id") .HasColumnType("uuid") .HasColumnName("id"); b.Property("BaseUrl") .IsRequired() .HasColumnType("text") .HasColumnName("base_url"); b.Property("Domain") .IsRequired() .HasColumnType("text") .HasColumnName("domain"); b.Property("PublicKey") .IsRequired() .HasColumnType("text") .HasColumnName("public_key"); b.Property("Reason") .HasColumnType("text") .HasColumnName("reason"); b.Property("Status") .HasColumnType("integer") .HasColumnName("status"); b.HasKey("Id") .HasName("pk_chat_instances"); b.HasIndex("Domain") .IsUnique() .HasDatabaseName("ix_chat_instances_domain"); b.ToTable("chat_instances", (string)null); }); modelBuilder.Entity("Foxchat.Identity.Database.Models.GuildAccount", b => { b.Property("ChatInstanceId") .HasColumnType("uuid") .HasColumnName("chat_instance_id"); b.Property("GuildId") .HasColumnType("text") .HasColumnName("guild_id"); b.Property("AccountId") .HasColumnType("uuid") .HasColumnName("account_id"); b.HasKey("ChatInstanceId", "GuildId", "AccountId") .HasName("pk_guild_accounts"); b.HasIndex("AccountId") .HasDatabaseName("ix_guild_accounts_account_id"); b.ToTable("guild_accounts", (string)null); }); modelBuilder.Entity("Foxchat.Identity.Database.Models.Token", b => { b.Property("Id") .HasColumnType("uuid") .HasColumnName("id"); b.Property("AccountId") .HasColumnType("uuid") .HasColumnName("account_id"); b.HasKey("Id") .HasName("pk_tokens"); b.HasIndex("AccountId") .HasDatabaseName("ix_tokens_account_id"); b.ToTable("tokens", (string)null); }); modelBuilder.Entity("AccountChatInstance", b => { b.HasOne("Foxchat.Identity.Database.Models.Account", null) .WithMany() .HasForeignKey("AccountsId") .OnDelete(DeleteBehavior.Cascade) .IsRequired() .HasConstraintName("fk_account_chat_instance_accounts_accounts_id"); b.HasOne("Foxchat.Identity.Database.Models.ChatInstance", null) .WithMany() .HasForeignKey("ChatInstancesId") .OnDelete(DeleteBehavior.Cascade) .IsRequired() .HasConstraintName("fk_account_chat_instance_chat_instances_chat_instances_id"); }); modelBuilder.Entity("Foxchat.Identity.Database.Models.GuildAccount", b => { b.HasOne("Foxchat.Identity.Database.Models.Account", "Account") .WithMany() .HasForeignKey("AccountId") .OnDelete(DeleteBehavior.Cascade) .IsRequired() .HasConstraintName("fk_guild_accounts_accounts_account_id"); b.HasOne("Foxchat.Identity.Database.Models.ChatInstance", "ChatInstance") .WithMany() .HasForeignKey("ChatInstanceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired() .HasConstraintName("fk_guild_accounts_chat_instances_chat_instance_id"); b.Navigation("Account"); b.Navigation("ChatInstance"); }); modelBuilder.Entity("Foxchat.Identity.Database.Models.Token", b => { b.HasOne("Foxchat.Identity.Database.Models.Account", "Account") .WithMany("Tokens") .HasForeignKey("AccountId") .OnDelete(DeleteBehavior.Cascade) .IsRequired() .HasConstraintName("fk_tokens_accounts_account_id"); b.Navigation("Account"); }); modelBuilder.Entity("Foxchat.Identity.Database.Models.Account", b => { b.Navigation("Tokens"); }); #pragma warning restore 612, 618 } } }