325 lines
12 KiB
C#
325 lines
12 KiB
C#
// <auto-generated />
|
|
using System;
|
|
using Foxchat.Chat.Database;
|
|
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 Foxchat.Chat.Migrations
|
|
{
|
|
[DbContext(typeof(ChatContext))]
|
|
[Migration("20240521132416_Init")]
|
|
partial class Init
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
{
|
|
#pragma warning disable 612, 618
|
|
modelBuilder
|
|
.HasAnnotation("ProductVersion", "8.0.5")
|
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
|
|
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
|
|
|
modelBuilder.Entity("Foxchat.Chat.Database.Models.Channel", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.HasColumnType("uuid")
|
|
.HasColumnName("id");
|
|
|
|
b.Property<Guid>("GuildId")
|
|
.HasColumnType("uuid")
|
|
.HasColumnName("guild_id");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasColumnType("text")
|
|
.HasColumnName("name");
|
|
|
|
b.Property<string>("Topic")
|
|
.HasColumnType("text")
|
|
.HasColumnName("topic");
|
|
|
|
b.HasKey("Id")
|
|
.HasName("pk_channels");
|
|
|
|
b.HasIndex("GuildId")
|
|
.HasDatabaseName("ix_channels_guild_id");
|
|
|
|
b.ToTable("channels", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("Foxchat.Chat.Database.Models.Guild", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.HasColumnType("uuid")
|
|
.HasColumnName("id");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasColumnType("text")
|
|
.HasColumnName("name");
|
|
|
|
b.Property<Guid>("OwnerId")
|
|
.HasColumnType("uuid")
|
|
.HasColumnName("owner_id");
|
|
|
|
b.HasKey("Id")
|
|
.HasName("pk_guilds");
|
|
|
|
b.HasIndex("OwnerId")
|
|
.HasDatabaseName("ix_guilds_owner_id");
|
|
|
|
b.ToTable("guilds", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("Foxchat.Chat.Database.Models.IdentityInstance", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.HasColumnType("uuid")
|
|
.HasColumnName("id");
|
|
|
|
b.Property<string>("BaseUrl")
|
|
.IsRequired()
|
|
.HasColumnType("text")
|
|
.HasColumnName("base_url");
|
|
|
|
b.Property<string>("Domain")
|
|
.IsRequired()
|
|
.HasColumnType("text")
|
|
.HasColumnName("domain");
|
|
|
|
b.Property<string>("PublicKey")
|
|
.IsRequired()
|
|
.HasColumnType("text")
|
|
.HasColumnName("public_key");
|
|
|
|
b.Property<string>("Reason")
|
|
.HasColumnType("text")
|
|
.HasColumnName("reason");
|
|
|
|
b.Property<int>("Status")
|
|
.HasColumnType("integer")
|
|
.HasColumnName("status");
|
|
|
|
b.HasKey("Id")
|
|
.HasName("pk_identity_instances");
|
|
|
|
b.HasIndex("Domain")
|
|
.IsUnique()
|
|
.HasDatabaseName("ix_identity_instances_domain");
|
|
|
|
b.ToTable("identity_instances", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("Foxchat.Chat.Database.Models.Message", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.HasColumnType("uuid")
|
|
.HasColumnName("id");
|
|
|
|
b.Property<Guid>("AuthorId")
|
|
.HasColumnType("uuid")
|
|
.HasColumnName("author_id");
|
|
|
|
b.Property<Guid>("ChannelId")
|
|
.HasColumnType("uuid")
|
|
.HasColumnName("channel_id");
|
|
|
|
b.Property<string>("Content")
|
|
.HasColumnType("text")
|
|
.HasColumnName("content");
|
|
|
|
b.Property<Instant?>("UpdatedAt")
|
|
.HasColumnType("timestamp with time zone")
|
|
.HasColumnName("updated_at");
|
|
|
|
b.HasKey("Id")
|
|
.HasName("pk_messages");
|
|
|
|
b.HasIndex("AuthorId")
|
|
.HasDatabaseName("ix_messages_author_id");
|
|
|
|
b.HasIndex("ChannelId")
|
|
.HasDatabaseName("ix_messages_channel_id");
|
|
|
|
b.ToTable("messages", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("Foxchat.Chat.Database.Models.User", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.HasColumnType("uuid")
|
|
.HasColumnName("id");
|
|
|
|
b.Property<string>("Avatar")
|
|
.HasColumnType("text")
|
|
.HasColumnName("avatar");
|
|
|
|
b.Property<Guid>("InstanceId")
|
|
.HasColumnType("uuid")
|
|
.HasColumnName("instance_id");
|
|
|
|
b.Property<string>("RemoteUserId")
|
|
.IsRequired()
|
|
.HasColumnType("text")
|
|
.HasColumnName("remote_user_id");
|
|
|
|
b.Property<string>("Username")
|
|
.IsRequired()
|
|
.HasColumnType("text")
|
|
.HasColumnName("username");
|
|
|
|
b.HasKey("Id")
|
|
.HasName("pk_users");
|
|
|
|
b.HasIndex("InstanceId")
|
|
.HasDatabaseName("ix_users_instance_id");
|
|
|
|
b.HasIndex("RemoteUserId", "InstanceId")
|
|
.IsUnique()
|
|
.HasDatabaseName("ix_users_remote_user_id_instance_id");
|
|
|
|
b.HasIndex("Username", "InstanceId")
|
|
.IsUnique()
|
|
.HasDatabaseName("ix_users_username_instance_id");
|
|
|
|
b.ToTable("users", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("Foxchat.Core.Database.Instance", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("integer")
|
|
.HasColumnName("id");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("PrivateKey")
|
|
.IsRequired()
|
|
.HasColumnType("text")
|
|
.HasColumnName("private_key");
|
|
|
|
b.Property<string>("PublicKey")
|
|
.IsRequired()
|
|
.HasColumnType("text")
|
|
.HasColumnName("public_key");
|
|
|
|
b.HasKey("Id")
|
|
.HasName("pk_instance");
|
|
|
|
b.ToTable("instance", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("GuildUser", b =>
|
|
{
|
|
b.Property<Guid>("GuildsId")
|
|
.HasColumnType("uuid")
|
|
.HasColumnName("guilds_id");
|
|
|
|
b.Property<Guid>("UsersId")
|
|
.HasColumnType("uuid")
|
|
.HasColumnName("users_id");
|
|
|
|
b.HasKey("GuildsId", "UsersId")
|
|
.HasName("pk_guild_user");
|
|
|
|
b.HasIndex("UsersId")
|
|
.HasDatabaseName("ix_guild_user_users_id");
|
|
|
|
b.ToTable("guild_user", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("Foxchat.Chat.Database.Models.Channel", b =>
|
|
{
|
|
b.HasOne("Foxchat.Chat.Database.Models.Guild", "Guild")
|
|
.WithMany("Channels")
|
|
.HasForeignKey("GuildId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired()
|
|
.HasConstraintName("fk_channels_guilds_guild_id");
|
|
|
|
b.Navigation("Guild");
|
|
});
|
|
|
|
modelBuilder.Entity("Foxchat.Chat.Database.Models.Guild", b =>
|
|
{
|
|
b.HasOne("Foxchat.Chat.Database.Models.User", "Owner")
|
|
.WithMany("OwnedGuilds")
|
|
.HasForeignKey("OwnerId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired()
|
|
.HasConstraintName("fk_guilds_users_owner_id");
|
|
|
|
b.Navigation("Owner");
|
|
});
|
|
|
|
modelBuilder.Entity("Foxchat.Chat.Database.Models.Message", b =>
|
|
{
|
|
b.HasOne("Foxchat.Chat.Database.Models.User", "Author")
|
|
.WithMany()
|
|
.HasForeignKey("AuthorId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired()
|
|
.HasConstraintName("fk_messages_users_author_id");
|
|
|
|
b.HasOne("Foxchat.Chat.Database.Models.Channel", "Channel")
|
|
.WithMany()
|
|
.HasForeignKey("ChannelId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired()
|
|
.HasConstraintName("fk_messages_channels_channel_id");
|
|
|
|
b.Navigation("Author");
|
|
|
|
b.Navigation("Channel");
|
|
});
|
|
|
|
modelBuilder.Entity("Foxchat.Chat.Database.Models.User", b =>
|
|
{
|
|
b.HasOne("Foxchat.Chat.Database.Models.IdentityInstance", "Instance")
|
|
.WithMany()
|
|
.HasForeignKey("InstanceId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired()
|
|
.HasConstraintName("fk_users_identity_instances_instance_id");
|
|
|
|
b.Navigation("Instance");
|
|
});
|
|
|
|
modelBuilder.Entity("GuildUser", b =>
|
|
{
|
|
b.HasOne("Foxchat.Chat.Database.Models.Guild", null)
|
|
.WithMany()
|
|
.HasForeignKey("GuildsId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired()
|
|
.HasConstraintName("fk_guild_user_guilds_guilds_id");
|
|
|
|
b.HasOne("Foxchat.Chat.Database.Models.User", null)
|
|
.WithMany()
|
|
.HasForeignKey("UsersId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired()
|
|
.HasConstraintName("fk_guild_user_users_users_id");
|
|
});
|
|
|
|
modelBuilder.Entity("Foxchat.Chat.Database.Models.Guild", b =>
|
|
{
|
|
b.Navigation("Channels");
|
|
});
|
|
|
|
modelBuilder.Entity("Foxchat.Chat.Database.Models.User", b =>
|
|
{
|
|
b.Navigation("OwnedGuilds");
|
|
});
|
|
#pragma warning restore 612, 618
|
|
}
|
|
}
|
|
}
|