From 4bbb6fd55761d9847a8bc48525cf6b9f4d110d8f Mon Sep 17 00:00:00 2001 From: AtaS Date: Sun, 13 Oct 2024 19:52:28 +0100 Subject: [PATCH] Init migrations --- .../20241013185127_Init.Designer.cs | 2151 +++++++++++++++++ SwipetorApp/Migrations/20241013185127_Init.cs | 1468 +++++++++++ SwipetorApp/Migrations/DbCxModelSnapshot.cs | 2148 ++++++++++++++++ .../SqlQueries/Models/UserQueryModel.cs | 3 +- 4 files changed, 5768 insertions(+), 2 deletions(-) create mode 100644 SwipetorApp/Migrations/20241013185127_Init.Designer.cs create mode 100644 SwipetorApp/Migrations/20241013185127_Init.cs create mode 100644 SwipetorApp/Migrations/DbCxModelSnapshot.cs diff --git a/SwipetorApp/Migrations/20241013185127_Init.Designer.cs b/SwipetorApp/Migrations/20241013185127_Init.Designer.cs new file mode 100644 index 0000000..5ea6352 --- /dev/null +++ b/SwipetorApp/Migrations/20241013185127_Init.Designer.cs @@ -0,0 +1,2151 @@ +// +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using NpgsqlTypes; +using SwipetorApp.Models.DbEntities; + +#nullable disable + +namespace SwipetorApp.Migrations +{ + [DbContext(typeof(DbCx))] + [Migration("20241013185127_Init")] + partial class Init + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.6") + .HasAnnotation("Proxies:ChangeTracking", false) + .HasAnnotation("Proxies:CheckEquality", false) + .HasAnnotation("Proxies:LazyLoading", true) + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Action") + .HasColumnType("text") + .HasColumnName("action"); + + b.Property("BrowserAgent") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)") + .HasColumnName("browser_agent"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("EntityId") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("entity_id"); + + b.Property("EntityName") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("entity_name"); + + b.Property("Log") + .HasMaxLength(4096) + .HasColumnType("character varying(4096)") + .HasColumnName("log"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_audit_logs"); + + b.HasIndex("Action") + .HasDatabaseName("ix_audit_logs_action"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("ix_audit_logs_created_at"); + + b.HasIndex("CreatedIp") + .HasDatabaseName("ix_audit_logs_created_ip"); + + b.HasIndex("EntityId") + .HasDatabaseName("ix_audit_logs_entity_id"); + + b.HasIndex("EntityName") + .HasDatabaseName("ix_audit_logs_entity_name"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_audit_logs_user_id"); + + b.ToTable("audit_logs", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Comment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("LikeCount") + .HasColumnType("integer") + .HasColumnName("like_count"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("modified_ip"); + + b.Property("PostId") + .HasColumnType("integer") + .HasColumnName("post_id"); + + b.Property("Txt") + .IsRequired() + .HasMaxLength(65536) + .HasColumnType("character varying(65536)") + .HasColumnName("txt"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_comments"); + + b.HasIndex("LikeCount") + .HasDatabaseName("ix_comments_like_count"); + + b.HasIndex("PostId") + .HasDatabaseName("ix_comments_post_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_comments_user_id"); + + b.ToTable("comments", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.CustomDomain", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DomainName") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("domain_name"); + + b.Property("RecaptchaKey") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("recaptcha_key"); + + b.Property("RecaptchaSecret") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("recaptcha_secret"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_custom_domains"); + + b.HasIndex("DomainName") + .HasDatabaseName("ix_custom_domains_domain_name"); + + b.HasIndex("UserId") + .IsUnique() + .HasDatabaseName("ix_custom_domains_user_id"); + + b.ToTable("custom_domains", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.EnglishWord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Word") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("word"); + + b.HasKey("Id") + .HasName("pk_english_words"); + + b.ToTable("english_words", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.FavPost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("PostId") + .HasColumnType("integer") + .HasColumnName("post_id"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_fav_posts"); + + b.HasIndex("PostId") + .HasDatabaseName("ix_fav_posts_post_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_fav_posts_user_id"); + + b.ToTable("fav_posts", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Hub", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("LastPostAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_post_at"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("character varying(32)") + .HasColumnName("name"); + + b.Property("Ordering") + .HasColumnType("integer") + .HasColumnName("ordering"); + + b.Property("PhotoId") + .HasColumnType("uuid") + .HasColumnName("photo_id"); + + b.Property("PostCount") + .HasColumnType("integer") + .HasColumnName("post_count"); + + b.HasKey("Id") + .HasName("pk_hubs"); + + b.HasIndex("LastPostAt") + .HasDatabaseName("ix_hubs_last_post_at"); + + b.HasIndex("Ordering") + .HasDatabaseName("ix_hubs_ordering"); + + b.HasIndex("PhotoId") + .HasDatabaseName("ix_hubs_photo_id"); + + b.HasIndex("PostCount") + .HasDatabaseName("ix_hubs_post_count"); + + b.ToTable("hubs", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.KeyValue", b => + { + b.Property("Key") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("key"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("modified_ip"); + + b.Property("Value") + .HasMaxLength(4096) + .HasColumnType("character varying(4096)") + .HasColumnName("value"); + + b.HasKey("Key") + .HasName("pk_key_values"); + + b.ToTable("key_values", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Capital") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("capital"); + + b.Property("FullName") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("full_name"); + + b.Property("Iso2") + .HasMaxLength(2) + .HasColumnType("character varying(2)") + .HasColumnName("iso2"); + + b.Property("Iso3") + .HasMaxLength(3) + .HasColumnType("character varying(3)") + .HasColumnName("iso3"); + + b.Property("Lat") + .HasColumnType("double precision") + .HasColumnName("lat"); + + b.Property("Lng") + .HasColumnType("double precision") + .HasColumnName("lng"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("name"); + + b.Property("NameAscii") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("name_ascii"); + + b.Property("ParentId") + .HasColumnType("integer") + .HasColumnName("parent_id"); + + b.Property("Population") + .HasColumnType("integer") + .HasColumnName("population"); + + b.Property("SearchVector") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("tsvector") + .HasColumnName("search_vector") + .HasAnnotation("Npgsql:TsVectorConfig", "english") + .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Name", "NameAscii", "FullName" }); + + b.Property("SimplemapsId") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("simplemaps_id"); + + b.Property("Type") + .HasColumnType("integer") + .HasColumnName("type"); + + b.HasKey("Id") + .HasName("pk_locations"); + + b.HasIndex("FullName") + .HasDatabaseName("ix_locations_full_name"); + + b.HasIndex("Iso2") + .HasDatabaseName("ix_locations_iso2"); + + b.HasIndex("Iso3") + .HasDatabaseName("ix_locations_iso3"); + + b.HasIndex("Lat") + .HasDatabaseName("ix_locations_lat"); + + b.HasIndex("Lng") + .HasDatabaseName("ix_locations_lng"); + + b.HasIndex("Name") + .HasDatabaseName("ix_locations_name"); + + b.HasIndex("NameAscii") + .HasDatabaseName("ix_locations_name_ascii"); + + b.HasIndex("ParentId") + .HasDatabaseName("ix_locations_parent_id"); + + b.HasIndex("SearchVector") + .HasDatabaseName("ix_locations_search_vector"); + + NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); + + b.HasIndex("Type") + .HasDatabaseName("ix_locations_type"); + + b.ToTable("locations", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.LoginAttempt", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("BrowserAgent") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)") + .HasColumnName("browser_agent"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("LoginRequestId") + .HasColumnType("uuid") + .HasColumnName("login_request_id"); + + b.Property("TriedEmailCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("tried_email_code"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_login_attempts"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("ix_login_attempts_created_at"); + + b.HasIndex("CreatedIp") + .HasDatabaseName("ix_login_attempts_created_ip"); + + b.HasIndex("LoginRequestId") + .HasDatabaseName("ix_login_attempts_login_request_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_login_attempts_user_id"); + + b.ToTable("login_attempts", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.LoginRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("BrowserAgent") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)") + .HasColumnName("browser_agent"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("Email") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("email"); + + b.Property("EmailCode") + .HasMaxLength(32) + .HasColumnType("character varying(32)") + .HasColumnName("email_code"); + + b.Property("IsUsed") + .HasColumnType("boolean") + .HasColumnName("is_used"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_login_requests"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("ix_login_requests_created_at"); + + b.HasIndex("CreatedIp") + .HasDatabaseName("ix_login_requests_created_ip"); + + b.HasIndex("Email") + .HasDatabaseName("ix_login_requests_email"); + + b.HasIndex("EmailCode") + .HasDatabaseName("ix_login_requests_email_code"); + + b.HasIndex("IsUsed") + .HasDatabaseName("ix_login_requests_is_used"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_login_requests_user_id"); + + b.ToTable("login_requests", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Notif", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("Data") + .HasMaxLength(4096) + .HasColumnType("character varying(4096)") + .HasColumnName("data"); + + b.Property("IsRead") + .HasColumnType("boolean") + .HasColumnName("is_read"); + + b.Property("IsViewed") + .HasColumnType("boolean") + .HasColumnName("is_viewed"); + + b.Property("PushNotifSentAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("push_notif_sent_at"); + + b.Property("ReceiverUserId") + .HasColumnType("integer") + .HasColumnName("receiver_user_id"); + + b.Property("RelatedCommentId") + .HasColumnType("integer") + .HasColumnName("related_comment_id"); + + b.Property("RelatedPostId") + .HasColumnType("integer") + .HasColumnName("related_post_id"); + + b.Property("SenderUserId") + .HasColumnType("integer") + .HasColumnName("sender_user_id"); + + b.Property("Type") + .HasColumnType("integer") + .HasColumnName("type"); + + b.HasKey("Id") + .HasName("pk_notifs"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("ix_notifs_created_at"); + + b.HasIndex("IsRead") + .HasDatabaseName("ix_notifs_is_read"); + + b.HasIndex("IsViewed") + .HasDatabaseName("ix_notifs_is_viewed"); + + b.HasIndex("PushNotifSentAt") + .HasDatabaseName("ix_notifs_push_notif_sent_at"); + + b.HasIndex("ReceiverUserId") + .HasDatabaseName("ix_notifs_receiver_user_id"); + + b.HasIndex("RelatedCommentId") + .HasDatabaseName("ix_notifs_related_comment_id"); + + b.HasIndex("RelatedPostId") + .HasDatabaseName("ix_notifs_related_post_id"); + + b.HasIndex("SenderUserId") + .HasDatabaseName("ix_notifs_sender_user_id"); + + b.HasIndex("Type") + .HasDatabaseName("ix_notifs_type"); + + b.ToTable("notifs", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Photo", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("Ext") + .HasMaxLength(8) + .HasColumnType("character varying(8)") + .HasColumnName("ext"); + + b.Property("Height") + .HasColumnType("integer") + .HasColumnName("height"); + + b.Property("ReferenceUrl") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("reference_url"); + + b.Property>("Sizes") + .HasColumnType("integer[]") + .HasColumnName("sizes"); + + b.Property("Width") + .HasColumnType("integer") + .HasColumnName("width"); + + b.HasKey("Id") + .HasName("pk_photos"); + + b.ToTable("photos", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PmMsg", 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("ThreadId") + .HasColumnType("bigint") + .HasColumnName("thread_id"); + + b.Property("ThreadUserId") + .HasColumnType("integer") + .HasColumnName("thread_user_id"); + + b.Property("Txt") + .HasMaxLength(65536) + .HasColumnType("character varying(65536)") + .HasColumnName("txt"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_pm_msgs"); + + b.HasIndex("ThreadId") + .HasDatabaseName("ix_pm_msgs_thread_id"); + + b.HasIndex("ThreadUserId") + .HasDatabaseName("ix_pm_msgs_thread_user_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_pm_msgs_user_id"); + + b.ToTable("pm_msgs", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PmPermission", b => + { + b.Property("ReceiverUserId") + .HasColumnType("integer") + .HasColumnName("receiver_user_id"); + + b.Property("SenderUserId") + .HasColumnType("integer") + .HasColumnName("sender_user_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("IsAllowed") + .HasColumnType("boolean") + .HasColumnName("is_allowed"); + + b.Property("IsBlocked") + .HasColumnType("boolean") + .HasColumnName("is_blocked"); + + b.HasKey("ReceiverUserId", "SenderUserId") + .HasName("pk_pm_permissions"); + + b.HasIndex("IsAllowed") + .HasDatabaseName("ix_pm_permissions_is_allowed"); + + b.HasIndex("IsBlocked") + .HasDatabaseName("ix_pm_permissions_is_blocked"); + + b.HasIndex("SenderUserId") + .HasDatabaseName("ix_pm_permissions_sender_user_id"); + + b.ToTable("pm_permissions", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PmThread", 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("LastMsgAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_msg_at"); + + b.Property("LastMsgId") + .HasColumnType("bigint") + .HasColumnName("last_msg_id"); + + b.Property("UserCount") + .HasColumnType("integer") + .HasColumnName("user_count"); + + b.HasKey("Id") + .HasName("pk_pm_threads"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("ix_pm_threads_created_at"); + + b.HasIndex("LastMsgAt") + .HasDatabaseName("ix_pm_threads_last_msg_at"); + + b.HasIndex("LastMsgId") + .HasDatabaseName("ix_pm_threads_last_msg_id"); + + b.ToTable("pm_threads", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PmThreadUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("EmailSentAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("email_sent_at"); + + b.Property("FirstUnreadMsgId") + .HasColumnType("bigint") + .HasColumnName("first_unread_msg_id"); + + b.Property("IsInitiator") + .HasColumnType("boolean") + .HasColumnName("is_initiator"); + + b.Property("LastMsgAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_msg_at"); + + b.Property("LastReadMsgId") + .HasColumnType("bigint") + .HasColumnName("last_read_msg_id"); + + b.Property("ThreadId") + .HasColumnType("bigint") + .HasColumnName("thread_id"); + + b.Property("UnreadMsgCount") + .HasColumnType("integer") + .HasColumnName("unread_msg_count"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_pm_thread_users"); + + b.HasIndex("EmailSentAt") + .HasDatabaseName("ix_pm_thread_users_email_sent_at"); + + b.HasIndex("FirstUnreadMsgId") + .HasDatabaseName("ix_pm_thread_users_first_unread_msg_id"); + + b.HasIndex("IsInitiator") + .HasDatabaseName("ix_pm_thread_users_is_initiator"); + + b.HasIndex("LastMsgAt") + .HasDatabaseName("ix_pm_thread_users_last_msg_at"); + + b.HasIndex("LastReadMsgId") + .HasDatabaseName("ix_pm_thread_users_last_read_msg_id"); + + b.HasIndex("ThreadId") + .HasDatabaseName("ix_pm_thread_users_thread_id"); + + b.HasIndex("UnreadMsgCount") + .HasDatabaseName("ix_pm_thread_users_unread_msg_count"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_pm_thread_users_user_id"); + + b.ToTable("pm_thread_users", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Post", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CommentsCount") + .HasColumnType("integer") + .HasColumnName("comments_count"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("FavCount") + .HasColumnType("integer") + .HasColumnName("fav_count"); + + b.Property("IsPublished") + .HasColumnType("boolean") + .HasColumnName("is_published"); + + b.Property("IsRemoved") + .HasColumnType("boolean") + .HasColumnName("is_removed"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("Title") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("title"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_posts"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("ix_posts_created_at"); + + b.HasIndex("CreatedIp") + .HasDatabaseName("ix_posts_created_ip"); + + b.HasIndex("FavCount") + .HasDatabaseName("ix_posts_fav_count"); + + b.HasIndex("IsPublished") + .HasDatabaseName("ix_posts_is_published"); + + b.HasIndex("IsRemoved") + .HasDatabaseName("ix_posts_is_removed"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_posts_user_id"); + + b.ToTable("posts", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PostHub", b => + { + b.Property("PostId") + .HasColumnType("integer") + .HasColumnName("post_id"); + + b.Property("HubId") + .HasColumnType("integer") + .HasColumnName("hub_id"); + + b.HasKey("PostId", "HubId") + .HasName("pk_post_hubs"); + + b.HasIndex("HubId") + .HasDatabaseName("ix_post_hubs_hub_id"); + + b.ToTable("post_hubs", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PostMedia", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Article") + .HasMaxLength(1024000) + .HasColumnType("character varying(1024000)") + .HasColumnName("article"); + + b.Property("ClipTimes") + .HasColumnType("text") + .HasColumnName("clip_times"); + + b.Property("ClippedVideoId") + .HasColumnType("uuid") + .HasColumnName("clipped_video_id"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("character varying(512)") + .HasColumnName("description"); + + b.Property("IsFollowersOnly") + .HasColumnType("boolean") + .HasColumnName("is_followers_only"); + + b.Property("IsInstant") + .HasColumnType("boolean") + .HasColumnName("is_instant"); + + b.Property("Ordering") + .HasColumnType("integer") + .HasColumnName("ordering"); + + b.Property("PhotoId") + .HasColumnType("uuid") + .HasColumnName("photo_id"); + + b.Property("PostId") + .HasColumnType("integer") + .HasColumnName("post_id"); + + b.Property("PreviewPhotoId") + .HasColumnType("uuid") + .HasColumnName("preview_photo_id"); + + b.Property("PreviewPhotoTime") + .HasColumnType("double precision") + .HasColumnName("preview_photo_time"); + + b.Property("SubPlanId") + .HasColumnType("integer") + .HasColumnName("sub_plan_id"); + + b.Property("Type") + .HasColumnType("integer") + .HasColumnName("type"); + + b.Property("VideoId") + .HasColumnType("uuid") + .HasColumnName("video_id"); + + b.HasKey("Id") + .HasName("pk_post_medias"); + + b.HasIndex("ClippedVideoId") + .HasDatabaseName("ix_post_medias_clipped_video_id"); + + b.HasIndex("IsInstant") + .HasDatabaseName("ix_post_medias_is_instant"); + + b.HasIndex("Ordering") + .HasDatabaseName("ix_post_medias_ordering"); + + b.HasIndex("PhotoId") + .HasDatabaseName("ix_post_medias_photo_id"); + + b.HasIndex("PostId") + .HasDatabaseName("ix_post_medias_post_id"); + + b.HasIndex("PreviewPhotoId") + .HasDatabaseName("ix_post_medias_preview_photo_id"); + + b.HasIndex("SubPlanId") + .HasDatabaseName("ix_post_medias_sub_plan_id"); + + b.HasIndex("Type") + .HasDatabaseName("ix_post_medias_type"); + + b.HasIndex("VideoId") + .HasDatabaseName("ix_post_medias_video_id"); + + b.ToTable("post_medias", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PostNotifBatch", b => + { + b.Property("PostId") + .HasColumnType("integer") + .HasColumnName("post_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("IsDone") + .HasColumnType("boolean") + .HasColumnName("is_done"); + + b.Property("ProcessedCount") + .HasColumnType("integer") + .HasColumnName("processed_count"); + + b.HasKey("PostId") + .HasName("pk_post_notif_batches"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("ix_post_notif_batches_created_at"); + + b.HasIndex("IsDone") + .HasDatabaseName("ix_post_notif_batches_is_done"); + + b.ToTable("post_notif_batches", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PostView", b => + { + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.Property("PostId") + .HasColumnType("integer") + .HasColumnName("post_id"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("ViewedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("viewed_at"); + + b.HasKey("UserId", "PostId") + .HasName("pk_post_views"); + + b.HasIndex("PostId") + .HasDatabaseName("ix_post_views_post_id"); + + b.ToTable("post_views", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PushDevice", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("LastUsedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_used_at"); + + b.Property("Token") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("token"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_push_devices"); + + b.HasIndex("LastUsedAt") + .HasDatabaseName("ix_push_devices_last_used_at"); + + b.HasIndex("Token") + .HasDatabaseName("ix_push_devices_token"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_push_devices_user_id"); + + b.ToTable("push_devices", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.RemoteVideoInfo", b => + { + b.Property("RefDomain") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("ref_domain"); + + b.Property("RefId") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("ref_id"); + + b.Property("Action") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("action"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("ExtraInfo") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("extra_info"); + + b.HasKey("RefDomain", "RefId") + .HasName("pk_remote_video_infos"); + + b.HasIndex("Action") + .HasDatabaseName("ix_remote_video_infos_action"); + + b.ToTable("remote_video_infos", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Sprite", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Interval") + .HasColumnType("double precision") + .HasColumnName("interval"); + + b.Property("StartTime") + .HasColumnType("double precision") + .HasColumnName("start_time"); + + b.Property("ThumbnailCount") + .HasColumnType("integer") + .HasColumnName("thumbnail_count"); + + b.Property("ThumbnailHeight") + .HasColumnType("integer") + .HasColumnName("thumbnail_height"); + + b.Property("ThumbnailWidth") + .HasColumnType("integer") + .HasColumnName("thumbnail_width"); + + b.Property("VideoId") + .HasColumnType("uuid") + .HasColumnName("video_id"); + + b.HasKey("Id") + .HasName("pk_sprites"); + + b.HasIndex("VideoId") + .HasDatabaseName("ix_sprites_video_id"); + + b.ToTable("sprites", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Sub", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("BrowserAgent") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)") + .HasColumnName("browser_agent"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("EndedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("ended_at"); + + b.Property("IsActive") + .HasColumnType("boolean") + .HasColumnName("is_active"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("PlanId") + .HasColumnType("integer") + .HasColumnName("plan_id"); + + b.Property("StartedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("started_at"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_subscriptions"); + + b.HasIndex("CreatedIp") + .HasDatabaseName("ix_subscriptions_created_ip"); + + b.HasIndex("PlanId") + .HasDatabaseName("ix_subscriptions_plan_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_subscriptions_user_id"); + + b.ToTable("subscriptions", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.SubPlan", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Currency") + .HasColumnType("text") + .HasColumnName("currency"); + + b.Property("Description") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("description"); + + b.Property("Name") + .HasMaxLength(30) + .HasColumnType("character varying(30)") + .HasColumnName("name"); + + b.Property("OwnerUserId") + .HasColumnType("integer") + .HasColumnName("owner_user_id"); + + b.Property("Price") + .HasColumnType("numeric") + .HasColumnName("price"); + + b.HasKey("Id") + .HasName("pk_sub_plans"); + + b.HasIndex("OwnerUserId") + .HasDatabaseName("ix_sub_plans_owner_user_id"); + + b.ToTable("sub_plans", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("BrowserAgent") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)") + .HasColumnName("browser_agent"); + + b.Property("CommentCount") + .HasColumnType("integer") + .HasColumnName("comment_count"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("description"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("email"); + + b.Property("LastNotifCheckAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_notif_check_at"); + + b.Property("LastNotifEmailAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_notif_email_at"); + + b.Property("LastOnlineAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_online_at"); + + b.Property("LastOnlineIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("last_online_ip"); + + b.Property("LastPmCheckAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_pm_check_at"); + + b.Property("ModifiedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("modified_ip"); + + b.Property("NotifEmailIntervalHours") + .HasColumnType("integer") + .HasColumnName("notif_email_interval_hours"); + + b.Property("PhotoId") + .HasColumnType("uuid") + .HasColumnName("photo_id"); + + b.Property("PmEmailIntervalHours") + .HasColumnType("integer") + .HasColumnName("pm_email_interval_hours"); + + b.Property("PremiumUntil") + .HasColumnType("timestamp with time zone") + .HasColumnName("premium_until"); + + b.Property("RobotSource") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("robot_source"); + + b.Property("Role") + .HasColumnType("integer") + .HasColumnName("role"); + + b.Property("Secret") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("character varying(16)") + .HasColumnName("secret"); + + b.Property("Username") + .HasMaxLength(18) + .HasColumnType("character varying(18)") + .HasColumnName("username"); + + b.HasKey("Id") + .HasName("pk_users"); + + b.HasIndex("CreatedIp") + .HasDatabaseName("ix_users_created_ip"); + + b.HasIndex("Email") + .HasDatabaseName("ix_users_email"); + + b.HasIndex("LastNotifCheckAt") + .HasDatabaseName("ix_users_last_notif_check_at"); + + b.HasIndex("LastNotifEmailAt") + .HasDatabaseName("ix_users_last_notif_email_at"); + + b.HasIndex("LastOnlineAt") + .HasDatabaseName("ix_users_last_online_at"); + + b.HasIndex("LastPmCheckAt") + .HasDatabaseName("ix_users_last_pm_check_at"); + + b.HasIndex("ModifiedIp") + .HasDatabaseName("ix_users_modified_ip"); + + b.HasIndex("NotifEmailIntervalHours") + .HasDatabaseName("ix_users_notif_email_interval_hours"); + + b.HasIndex("PhotoId") + .HasDatabaseName("ix_users_photo_id"); + + b.HasIndex("PmEmailIntervalHours") + .HasDatabaseName("ix_users_pm_email_interval_hours"); + + b.HasIndex("Role") + .HasDatabaseName("ix_users_role"); + + b.HasIndex("Username") + .IsUnique() + .HasDatabaseName("ix_users_username"); + + b.ToTable("users", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.UserFollow", b => + { + b.Property("FollowerUserId") + .HasColumnType("integer") + .HasColumnName("follower_user_id"); + + b.Property("FollowedUserId") + .HasColumnType("integer") + .HasColumnName("followed_user_id"); + + b.Property("LastNewPostNotifAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_new_post_notif_at"); + + b.HasKey("FollowerUserId", "FollowedUserId") + .HasName("pk_user_follows"); + + b.HasIndex("FollowedUserId") + .HasDatabaseName("ix_user_follows_followed_user_id"); + + b.HasIndex("LastNewPostNotifAt") + .HasDatabaseName("ix_user_follows_last_new_post_notif_at"); + + b.ToTable("user_follows", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Video", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Captions") + .HasMaxLength(102400) + .HasColumnType("character varying(102400)") + .HasColumnName("captions"); + + b.Property("Checksum") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("checksum"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("Duration") + .HasColumnType("double precision") + .HasColumnName("duration"); + + b.Property("Ext") + .HasMaxLength(8) + .HasColumnType("character varying(8)") + .HasColumnName("ext"); + + b.Property("Formats") + .HasColumnType("jsonb") + .HasColumnName("formats"); + + b.Property("Height") + .HasColumnType("integer") + .HasColumnName("height"); + + b.Property("ReferenceDesc") + .HasMaxLength(102400) + .HasColumnType("character varying(102400)") + .HasColumnName("reference_desc"); + + b.Property("ReferenceDomain") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("reference_domain"); + + b.Property("ReferenceId") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("reference_id"); + + b.Property("ReferenceJson") + .HasMaxLength(1024000) + .HasColumnType("character varying(1024000)") + .HasColumnName("reference_json"); + + b.Property("ReferenceTitle") + .HasMaxLength(512) + .HasColumnType("character varying(512)") + .HasColumnName("reference_title"); + + b.Property("ReferenceUrl") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("reference_url"); + + b.Property("SizeInBytes") + .HasColumnType("bigint") + .HasColumnName("size_in_bytes"); + + b.Property("Width") + .HasColumnType("integer") + .HasColumnName("width"); + + b.HasKey("Id") + .HasName("pk_videos"); + + b.HasIndex("Checksum") + .HasDatabaseName("ix_videos_checksum"); + + b.HasIndex("ReferenceDomain") + .HasDatabaseName("ix_videos_reference_domain"); + + b.HasIndex("ReferenceId") + .HasDatabaseName("ix_videos_reference_id"); + + b.HasIndex("SizeInBytes") + .HasDatabaseName("ix_videos_size_in_bytes"); + + b.ToTable("videos", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.AuditLog", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_audit_logs_users_user_id"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Comment", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.Post", "Post") + .WithMany("Comments") + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_comments_posts_post_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_comments_users_user_id"); + + b.Navigation("Post"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.CustomDomain", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithOne("CustomDomain") + .HasForeignKey("SwipetorApp.Models.DbEntities.CustomDomain", "UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_custom_domains_users_user_id"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.FavPost", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.Post", "Post") + .WithMany("Favs") + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_fav_posts_posts_post_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_fav_posts_users_user_id"); + + b.Navigation("Post"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Hub", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.Photo", "Photo") + .WithMany() + .HasForeignKey("PhotoId") + .HasConstraintName("fk_hubs_photos_photo_id"); + + b.Navigation("Photo"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Location", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.Location", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId") + .HasConstraintName("fk_locations_locations_parent_id"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.LoginAttempt", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.LoginRequest", "LoginRequest") + .WithMany() + .HasForeignKey("LoginRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_login_attempts_login_requests_login_request_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .HasConstraintName("fk_login_attempts_users_user_id"); + + b.Navigation("LoginRequest"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.LoginRequest", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .HasConstraintName("fk_login_requests_users_user_id"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Notif", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.User", "ReceiverUser") + .WithMany("Notifs") + .HasForeignKey("ReceiverUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_notifs_users_receiver_user_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.Comment", "RelatedComment") + .WithMany() + .HasForeignKey("RelatedCommentId") + .HasConstraintName("fk_notifs_comments_related_comment_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.Post", "RelatedPost") + .WithMany() + .HasForeignKey("RelatedPostId") + .HasConstraintName("fk_notifs_posts_related_post_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.User", "SenderUser") + .WithMany() + .HasForeignKey("SenderUserId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_notifs_users_sender_user_id"); + + b.Navigation("ReceiverUser"); + + b.Navigation("RelatedComment"); + + b.Navigation("RelatedPost"); + + b.Navigation("SenderUser"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PmMsg", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.PmThread", "Thread") + .WithMany("Msgs") + .HasForeignKey("ThreadId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_pm_msgs_pm_threads_thread_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.PmThreadUser", "ThreadUser") + .WithMany("Msgs") + .HasForeignKey("ThreadUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_pm_msgs_pm_thread_users_thread_user_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_pm_msgs_users_user_id"); + + b.Navigation("Thread"); + + b.Navigation("ThreadUser"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PmPermission", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.User", "ReceiverUser") + .WithMany() + .HasForeignKey("ReceiverUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_pm_permissions_users_receiver_user_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.User", "SenderUser") + .WithMany() + .HasForeignKey("SenderUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_pm_permissions_users_sender_user_id"); + + b.Navigation("ReceiverUser"); + + b.Navigation("SenderUser"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PmThread", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.PmMsg", "LastMsg") + .WithMany() + .HasForeignKey("LastMsgId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_pm_threads_pm_msgs_last_msg_id"); + + b.Navigation("LastMsg"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PmThreadUser", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.PmMsg", "FirstUnreadMsg") + .WithMany() + .HasForeignKey("FirstUnreadMsgId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_pm_thread_users_pm_msgs_first_unread_msg_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.PmMsg", "LastReadMsg") + .WithMany() + .HasForeignKey("LastReadMsgId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_pm_thread_users_pm_msgs_last_read_msg_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.PmThread", "Thread") + .WithMany("ThreadUsers") + .HasForeignKey("ThreadId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_pm_thread_users_pm_threads_thread_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithMany("PmThreadUsers") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_pm_thread_users_users_user_id"); + + b.Navigation("FirstUnreadMsg"); + + b.Navigation("LastReadMsg"); + + b.Navigation("Thread"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Post", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithMany("Posts") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_posts_users_user_id"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PostHub", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.Hub", "Hub") + .WithMany("PostHubs") + .HasForeignKey("HubId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_post_hubs_hubs_hub_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.Post", "Post") + .WithMany("PostHubs") + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_post_hubs_posts_post_id"); + + b.Navigation("Hub"); + + b.Navigation("Post"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PostMedia", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.Video", "ClippedVideo") + .WithMany() + .HasForeignKey("ClippedVideoId") + .HasConstraintName("fk_post_medias_videos_clipped_video_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.Photo", "Photo") + .WithMany() + .HasForeignKey("PhotoId") + .HasConstraintName("fk_post_medias_photos_photo_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.Post", "Post") + .WithMany("Medias") + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_post_medias_posts_post_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.Photo", "PreviewPhoto") + .WithMany() + .HasForeignKey("PreviewPhotoId") + .HasConstraintName("fk_post_medias_photos_preview_photo_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.SubPlan", "SubPlan") + .WithMany() + .HasForeignKey("SubPlanId") + .HasConstraintName("fk_post_medias_sub_plans_sub_plan_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.Video", "Video") + .WithMany() + .HasForeignKey("VideoId") + .HasConstraintName("fk_post_medias_videos_video_id"); + + b.Navigation("ClippedVideo"); + + b.Navigation("Photo"); + + b.Navigation("Post"); + + b.Navigation("PreviewPhoto"); + + b.Navigation("SubPlan"); + + b.Navigation("Video"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PostNotifBatch", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.Post", "Post") + .WithOne("NotifBatch") + .HasForeignKey("SwipetorApp.Models.DbEntities.PostNotifBatch", "PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_post_notif_batches_posts_post_id"); + + b.Navigation("Post"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PostView", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.Post", "Post") + .WithMany("PostViews") + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_post_views_posts_post_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_post_views_users_user_id"); + + b.Navigation("Post"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PushDevice", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithMany("PushDevices") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_push_devices_users_user_id"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Sprite", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.Video", "Video") + .WithMany("Sprites") + .HasForeignKey("VideoId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_sprites_videos_video_id"); + + b.Navigation("Video"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Sub", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.SubPlan", "Plan") + .WithMany("Subscriptions") + .HasForeignKey("PlanId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_subscriptions_sub_plans_plan_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithMany("Subscriptions") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_subscriptions_users_user_id"); + + b.Navigation("Plan"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.SubPlan", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.User", "OwnerUser") + .WithMany("OwnedSubscriptionPlans") + .HasForeignKey("OwnerUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_sub_plans_users_owner_user_id"); + + b.Navigation("OwnerUser"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.User", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.Photo", "Photo") + .WithMany() + .HasForeignKey("PhotoId") + .HasConstraintName("fk_users_photos_photo_id"); + + b.Navigation("Photo"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.UserFollow", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.User", "FollowedUser") + .WithMany("Followers") + .HasForeignKey("FollowedUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_user_follows_users_followed_user_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.User", "FollowerUser") + .WithMany("Following") + .HasForeignKey("FollowerUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_user_follows_users_follower_user_id"); + + b.Navigation("FollowedUser"); + + b.Navigation("FollowerUser"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Hub", b => + { + b.Navigation("PostHubs"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Location", b => + { + b.Navigation("Children"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PmThread", b => + { + b.Navigation("Msgs"); + + b.Navigation("ThreadUsers"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PmThreadUser", b => + { + b.Navigation("Msgs"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Post", b => + { + b.Navigation("Comments"); + + b.Navigation("Favs"); + + b.Navigation("Medias"); + + b.Navigation("NotifBatch"); + + b.Navigation("PostHubs"); + + b.Navigation("PostViews"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.SubPlan", b => + { + b.Navigation("Subscriptions"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.User", b => + { + b.Navigation("CustomDomain"); + + b.Navigation("Followers"); + + b.Navigation("Following"); + + b.Navigation("Notifs"); + + b.Navigation("OwnedSubscriptionPlans"); + + b.Navigation("PmThreadUsers"); + + b.Navigation("Posts"); + + b.Navigation("PushDevices"); + + b.Navigation("Subscriptions"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Video", b => + { + b.Navigation("Sprites"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/SwipetorApp/Migrations/20241013185127_Init.cs b/SwipetorApp/Migrations/20241013185127_Init.cs new file mode 100644 index 0000000..ba7dbe0 --- /dev/null +++ b/SwipetorApp/Migrations/20241013185127_Init.cs @@ -0,0 +1,1468 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using NpgsqlTypes; + +#nullable disable + +namespace SwipetorApp.Migrations +{ + /// + public partial class Init : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "english_words", + columns: table => new + { + id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + word = table.Column(type: "character varying(128)", maxLength: 128, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_english_words", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "key_values", + columns: table => new + { + key = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), + value = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), + modified_ip = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), + modified_at = table.Column(type: "timestamp with time zone", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_key_values", x => x.key); + }); + + migrationBuilder.CreateTable( + name: "locations", + columns: table => new + { + id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + name = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), + name_ascii = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), + full_name = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), + search_vector = table.Column(type: "tsvector", nullable: true) + .Annotation("Npgsql:TsVectorConfig", "english") + .Annotation("Npgsql:TsVectorProperties", new[] { "name", "name_ascii", "full_name" }), + lat = table.Column(type: "double precision", nullable: false), + lng = table.Column(type: "double precision", nullable: false), + population = table.Column(type: "integer", nullable: false), + capital = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + iso2 = table.Column(type: "character varying(2)", maxLength: 2, nullable: true), + iso3 = table.Column(type: "character varying(3)", maxLength: 3, nullable: true), + simplemaps_id = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + type = table.Column(type: "integer", nullable: false), + parent_id = table.Column(type: "integer", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_locations", x => x.id); + table.ForeignKey( + name: "fk_locations_locations_parent_id", + column: x => x.parent_id, + principalTable: "locations", + principalColumn: "id"); + }); + + migrationBuilder.CreateTable( + name: "photos", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + reference_url = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + created_ip = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), + height = table.Column(type: "integer", nullable: false), + width = table.Column(type: "integer", nullable: false), + ext = table.Column(type: "character varying(8)", maxLength: 8, nullable: true), + sizes = table.Column>(type: "integer[]", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_photos", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "remote_video_infos", + columns: table => new + { + ref_domain = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), + ref_id = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), + extra_info = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true), + action = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), + created_at = table.Column(type: "timestamp with time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("pk_remote_video_infos", x => new { x.ref_domain, x.ref_id }); + }); + + migrationBuilder.CreateTable( + name: "videos", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + ext = table.Column(type: "character varying(8)", maxLength: 8, nullable: true), + size_in_bytes = table.Column(type: "bigint", nullable: false), + width = table.Column(type: "integer", nullable: false), + height = table.Column(type: "integer", nullable: false), + duration = table.Column(type: "double precision", nullable: false), + checksum = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + captions = table.Column(type: "character varying(102400)", maxLength: 102400, nullable: true), + reference_url = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true), + reference_domain = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), + reference_id = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), + reference_title = table.Column(type: "character varying(512)", maxLength: 512, nullable: true), + reference_desc = table.Column(type: "character varying(102400)", maxLength: 102400, nullable: true), + reference_json = table.Column(type: "character varying(1024000)", maxLength: 1024000, nullable: true), + formats = table.Column(type: "jsonb", nullable: true), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + created_ip = table.Column(type: "character varying(64)", maxLength: 64, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("pk_videos", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "hubs", + columns: table => new + { + id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + name = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), + last_post_at = table.Column(type: "timestamp with time zone", nullable: true), + ordering = table.Column(type: "integer", nullable: false), + post_count = table.Column(type: "integer", nullable: false), + photo_id = table.Column(type: "uuid", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_hubs", x => x.id); + table.ForeignKey( + name: "fk_hubs_photos_photo_id", + column: x => x.photo_id, + principalTable: "photos", + principalColumn: "id"); + }); + + migrationBuilder.CreateTable( + name: "users", + columns: table => new + { + id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + email = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), + username = table.Column(type: "character varying(18)", maxLength: 18, nullable: true), + secret = table.Column(type: "character varying(16)", maxLength: 16, nullable: false), + comment_count = table.Column(type: "integer", nullable: false), + role = table.Column(type: "integer", nullable: false), + last_pm_check_at = table.Column(type: "timestamp with time zone", nullable: false), + last_notif_check_at = table.Column(type: "timestamp with time zone", nullable: false), + last_notif_email_at = table.Column(type: "timestamp with time zone", nullable: false), + last_online_at = table.Column(type: "timestamp with time zone", nullable: false), + last_online_ip = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), + pm_email_interval_hours = table.Column(type: "integer", nullable: true), + notif_email_interval_hours = table.Column(type: "integer", nullable: true), + photo_id = table.Column(type: "uuid", nullable: true), + description = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + robot_source = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + premium_until = table.Column(type: "timestamp with time zone", nullable: true), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + created_ip = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), + modified_ip = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), + browser_agent = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_users", x => x.id); + table.ForeignKey( + name: "fk_users_photos_photo_id", + column: x => x.photo_id, + principalTable: "photos", + principalColumn: "id"); + }); + + migrationBuilder.CreateTable( + name: "sprites", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + video_id = table.Column(type: "uuid", nullable: false), + start_time = table.Column(type: "double precision", nullable: false), + interval = table.Column(type: "double precision", nullable: false), + thumbnail_count = table.Column(type: "integer", nullable: false), + thumbnail_width = table.Column(type: "integer", nullable: false), + thumbnail_height = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("pk_sprites", x => x.id); + table.ForeignKey( + name: "fk_sprites_videos_video_id", + column: x => x.video_id, + principalTable: "videos", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "audit_logs", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + entity_name = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), + entity_id = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), + user_id = table.Column(type: "integer", nullable: false), + action = table.Column(type: "text", nullable: true), + log = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), + created_ip = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), + browser_agent = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_audit_logs", x => x.id); + table.ForeignKey( + name: "fk_audit_logs_users_user_id", + column: x => x.user_id, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "custom_domains", + columns: table => new + { + id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + domain_name = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), + user_id = table.Column(type: "integer", nullable: false), + recaptcha_key = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), + recaptcha_secret = table.Column(type: "character varying(128)", maxLength: 128, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_custom_domains", x => x.id); + table.ForeignKey( + name: "fk_custom_domains_users_user_id", + column: x => x.user_id, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "login_requests", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + email = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), + user_id = table.Column(type: "integer", nullable: true), + email_code = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), + is_used = table.Column(type: "boolean", nullable: false), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + created_ip = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), + browser_agent = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_login_requests", x => x.id); + table.ForeignKey( + name: "fk_login_requests_users_user_id", + column: x => x.user_id, + principalTable: "users", + principalColumn: "id"); + }); + + migrationBuilder.CreateTable( + name: "pm_permissions", + columns: table => new + { + receiver_user_id = table.Column(type: "integer", nullable: false), + sender_user_id = table.Column(type: "integer", nullable: false), + is_allowed = table.Column(type: "boolean", nullable: false), + is_blocked = table.Column(type: "boolean", nullable: false), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + created_ip = table.Column(type: "character varying(64)", maxLength: 64, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_pm_permissions", x => new { x.receiver_user_id, x.sender_user_id }); + table.ForeignKey( + name: "fk_pm_permissions_users_receiver_user_id", + column: x => x.receiver_user_id, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_pm_permissions_users_sender_user_id", + column: x => x.sender_user_id, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "posts", + columns: table => new + { + id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + title = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), + user_id = table.Column(type: "integer", nullable: false), + comments_count = table.Column(type: "integer", nullable: false), + fav_count = table.Column(type: "integer", nullable: false), + is_published = table.Column(type: "boolean", nullable: false), + is_removed = table.Column(type: "boolean", nullable: false), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + modified_at = table.Column(type: "timestamp with time zone", nullable: true), + created_ip = table.Column(type: "character varying(64)", maxLength: 64, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_posts", x => x.id); + table.ForeignKey( + name: "fk_posts_users_user_id", + column: x => x.user_id, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "push_devices", + columns: table => new + { + id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + user_id = table.Column(type: "integer", nullable: false), + created_ip = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), + last_used_at = table.Column(type: "timestamp with time zone", nullable: true), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + token = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("pk_push_devices", x => x.id); + table.ForeignKey( + name: "fk_push_devices_users_user_id", + column: x => x.user_id, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "sub_plans", + columns: table => new + { + id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + name = table.Column(type: "character varying(30)", maxLength: 30, nullable: true), + description = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), + currency = table.Column(type: "text", nullable: true), + price = table.Column(type: "numeric", nullable: true), + owner_user_id = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("pk_sub_plans", x => x.id); + table.ForeignKey( + name: "fk_sub_plans_users_owner_user_id", + column: x => x.owner_user_id, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "user_follows", + columns: table => new + { + follower_user_id = table.Column(type: "integer", nullable: false), + followed_user_id = table.Column(type: "integer", nullable: false), + last_new_post_notif_at = table.Column(type: "timestamp with time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("pk_user_follows", x => new { x.follower_user_id, x.followed_user_id }); + table.ForeignKey( + name: "fk_user_follows_users_followed_user_id", + column: x => x.followed_user_id, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_user_follows_users_follower_user_id", + column: x => x.follower_user_id, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "login_attempts", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + login_request_id = table.Column(type: "uuid", nullable: false), + user_id = table.Column(type: "integer", nullable: true), + tried_email_code = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + created_ip = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), + browser_agent = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_login_attempts", x => x.id); + table.ForeignKey( + name: "fk_login_attempts_login_requests_login_request_id", + column: x => x.login_request_id, + principalTable: "login_requests", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_login_attempts_users_user_id", + column: x => x.user_id, + principalTable: "users", + principalColumn: "id"); + }); + + migrationBuilder.CreateTable( + name: "comments", + columns: table => new + { + id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + txt = table.Column(type: "character varying(65536)", maxLength: 65536, nullable: false), + post_id = table.Column(type: "integer", nullable: false), + user_id = table.Column(type: "integer", nullable: false), + like_count = table.Column(type: "integer", nullable: false), + created_ip = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + modified_ip = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), + modified_at = table.Column(type: "timestamp with time zone", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_comments", x => x.id); + table.ForeignKey( + name: "fk_comments_posts_post_id", + column: x => x.post_id, + principalTable: "posts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_comments_users_user_id", + column: x => x.user_id, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "fav_posts", + columns: table => new + { + id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + post_id = table.Column(type: "integer", nullable: false), + user_id = table.Column(type: "integer", nullable: false), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + created_ip = table.Column(type: "character varying(64)", maxLength: 64, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_fav_posts", x => x.id); + table.ForeignKey( + name: "fk_fav_posts_posts_post_id", + column: x => x.post_id, + principalTable: "posts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_fav_posts_users_user_id", + column: x => x.user_id, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "post_hubs", + columns: table => new + { + post_id = table.Column(type: "integer", nullable: false), + hub_id = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("pk_post_hubs", x => new { x.post_id, x.hub_id }); + table.ForeignKey( + name: "fk_post_hubs_hubs_hub_id", + column: x => x.hub_id, + principalTable: "hubs", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_post_hubs_posts_post_id", + column: x => x.post_id, + principalTable: "posts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "post_notif_batches", + columns: table => new + { + post_id = table.Column(type: "integer", nullable: false), + processed_count = table.Column(type: "integer", nullable: false), + is_done = table.Column(type: "boolean", nullable: false), + created_at = table.Column(type: "timestamp with time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("pk_post_notif_batches", x => x.post_id); + table.ForeignKey( + name: "fk_post_notif_batches_posts_post_id", + column: x => x.post_id, + principalTable: "posts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "post_views", + columns: table => new + { + user_id = table.Column(type: "integer", nullable: false), + post_id = table.Column(type: "integer", nullable: false), + viewed_at = table.Column(type: "timestamp with time zone", nullable: false), + created_ip = table.Column(type: "character varying(64)", maxLength: 64, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_post_views", x => new { x.user_id, x.post_id }); + table.ForeignKey( + name: "fk_post_views_posts_post_id", + column: x => x.post_id, + principalTable: "posts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_post_views_users_user_id", + column: x => x.user_id, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "post_medias", + columns: table => new + { + id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + post_id = table.Column(type: "integer", nullable: false), + photo_id = table.Column(type: "uuid", nullable: true), + video_id = table.Column(type: "uuid", nullable: true), + clipped_video_id = table.Column(type: "uuid", nullable: true), + preview_photo_id = table.Column(type: "uuid", nullable: true), + preview_photo_time = table.Column(type: "double precision", nullable: true), + clip_times = table.Column(type: "text", nullable: true), + is_followers_only = table.Column(type: "boolean", nullable: false), + sub_plan_id = table.Column(type: "integer", nullable: true), + type = table.Column(type: "integer", nullable: false), + description = table.Column(type: "character varying(512)", maxLength: 512, nullable: true), + article = table.Column(type: "character varying(1024000)", maxLength: 1024000, nullable: true), + is_instant = table.Column(type: "boolean", nullable: false), + ordering = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("pk_post_medias", x => x.id); + table.ForeignKey( + name: "fk_post_medias_photos_photo_id", + column: x => x.photo_id, + principalTable: "photos", + principalColumn: "id"); + table.ForeignKey( + name: "fk_post_medias_photos_preview_photo_id", + column: x => x.preview_photo_id, + principalTable: "photos", + principalColumn: "id"); + table.ForeignKey( + name: "fk_post_medias_posts_post_id", + column: x => x.post_id, + principalTable: "posts", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_post_medias_sub_plans_sub_plan_id", + column: x => x.sub_plan_id, + principalTable: "sub_plans", + principalColumn: "id"); + table.ForeignKey( + name: "fk_post_medias_videos_clipped_video_id", + column: x => x.clipped_video_id, + principalTable: "videos", + principalColumn: "id"); + table.ForeignKey( + name: "fk_post_medias_videos_video_id", + column: x => x.video_id, + principalTable: "videos", + principalColumn: "id"); + }); + + migrationBuilder.CreateTable( + name: "subscriptions", + columns: table => new + { + id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + user_id = table.Column(type: "integer", nullable: false), + started_at = table.Column(type: "timestamp with time zone", nullable: false), + ended_at = table.Column(type: "timestamp with time zone", nullable: true), + is_active = table.Column(type: "boolean", nullable: false), + plan_id = table.Column(type: "integer", nullable: false), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + modified_at = table.Column(type: "timestamp with time zone", nullable: true), + browser_agent = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: true), + created_ip = table.Column(type: "character varying(64)", maxLength: 64, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_subscriptions", x => x.id); + table.ForeignKey( + name: "fk_subscriptions_sub_plans_plan_id", + column: x => x.plan_id, + principalTable: "sub_plans", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_subscriptions_users_user_id", + column: x => x.user_id, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "notifs", + columns: table => new + { + id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + receiver_user_id = table.Column(type: "integer", nullable: false), + related_post_id = table.Column(type: "integer", nullable: true), + related_comment_id = table.Column(type: "integer", nullable: true), + sender_user_id = table.Column(type: "integer", nullable: true), + type = table.Column(type: "integer", nullable: false), + data = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), + is_read = table.Column(type: "boolean", nullable: false), + is_viewed = table.Column(type: "boolean", nullable: false), + push_notif_sent_at = table.Column(type: "timestamp with time zone", nullable: true), + created_at = table.Column(type: "timestamp with time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("pk_notifs", x => x.id); + table.ForeignKey( + name: "fk_notifs_comments_related_comment_id", + column: x => x.related_comment_id, + principalTable: "comments", + principalColumn: "id"); + table.ForeignKey( + name: "fk_notifs_posts_related_post_id", + column: x => x.related_post_id, + principalTable: "posts", + principalColumn: "id"); + table.ForeignKey( + name: "fk_notifs_users_receiver_user_id", + column: x => x.receiver_user_id, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_notifs_users_sender_user_id", + column: x => x.sender_user_id, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "pm_msgs", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + thread_id = table.Column(type: "bigint", nullable: false), + thread_user_id = table.Column(type: "integer", nullable: false), + user_id = table.Column(type: "integer", nullable: false), + txt = table.Column(type: "character varying(65536)", maxLength: 65536, nullable: true), + created_at = table.Column(type: "timestamp with time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("pk_pm_msgs", x => x.id); + table.ForeignKey( + name: "fk_pm_msgs_users_user_id", + column: x => x.user_id, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "pm_threads", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + user_count = table.Column(type: "integer", nullable: false), + last_msg_id = table.Column(type: "bigint", nullable: true), + last_msg_at = table.Column(type: "timestamp with time zone", nullable: false), + created_at = table.Column(type: "timestamp with time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("pk_pm_threads", x => x.id); + table.ForeignKey( + name: "fk_pm_threads_pm_msgs_last_msg_id", + column: x => x.last_msg_id, + principalTable: "pm_msgs", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "pm_thread_users", + columns: table => new + { + id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + user_id = table.Column(type: "integer", nullable: false), + thread_id = table.Column(type: "bigint", nullable: false), + first_unread_msg_id = table.Column(type: "bigint", nullable: true), + last_read_msg_id = table.Column(type: "bigint", nullable: true), + unread_msg_count = table.Column(type: "integer", nullable: false), + is_initiator = table.Column(type: "boolean", nullable: false), + email_sent_at = table.Column(type: "timestamp with time zone", nullable: true), + last_msg_at = table.Column(type: "timestamp with time zone", nullable: false), + created_at = table.Column(type: "timestamp with time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("pk_pm_thread_users", x => x.id); + table.ForeignKey( + name: "fk_pm_thread_users_pm_msgs_first_unread_msg_id", + column: x => x.first_unread_msg_id, + principalTable: "pm_msgs", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_pm_thread_users_pm_msgs_last_read_msg_id", + column: x => x.last_read_msg_id, + principalTable: "pm_msgs", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_pm_thread_users_pm_threads_thread_id", + column: x => x.thread_id, + principalTable: "pm_threads", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_pm_thread_users_users_user_id", + column: x => x.user_id, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "ix_audit_logs_action", + table: "audit_logs", + column: "action"); + + migrationBuilder.CreateIndex( + name: "ix_audit_logs_created_at", + table: "audit_logs", + column: "created_at"); + + migrationBuilder.CreateIndex( + name: "ix_audit_logs_created_ip", + table: "audit_logs", + column: "created_ip"); + + migrationBuilder.CreateIndex( + name: "ix_audit_logs_entity_id", + table: "audit_logs", + column: "entity_id"); + + migrationBuilder.CreateIndex( + name: "ix_audit_logs_entity_name", + table: "audit_logs", + column: "entity_name"); + + migrationBuilder.CreateIndex( + name: "ix_audit_logs_user_id", + table: "audit_logs", + column: "user_id"); + + migrationBuilder.CreateIndex( + name: "ix_comments_like_count", + table: "comments", + column: "like_count"); + + migrationBuilder.CreateIndex( + name: "ix_comments_post_id", + table: "comments", + column: "post_id"); + + migrationBuilder.CreateIndex( + name: "ix_comments_user_id", + table: "comments", + column: "user_id"); + + migrationBuilder.CreateIndex( + name: "ix_custom_domains_domain_name", + table: "custom_domains", + column: "domain_name"); + + migrationBuilder.CreateIndex( + name: "ix_custom_domains_user_id", + table: "custom_domains", + column: "user_id", + unique: true); + + migrationBuilder.CreateIndex( + name: "ix_fav_posts_post_id", + table: "fav_posts", + column: "post_id"); + + migrationBuilder.CreateIndex( + name: "ix_fav_posts_user_id", + table: "fav_posts", + column: "user_id"); + + migrationBuilder.CreateIndex( + name: "ix_hubs_last_post_at", + table: "hubs", + column: "last_post_at"); + + migrationBuilder.CreateIndex( + name: "ix_hubs_ordering", + table: "hubs", + column: "ordering"); + + migrationBuilder.CreateIndex( + name: "ix_hubs_photo_id", + table: "hubs", + column: "photo_id"); + + migrationBuilder.CreateIndex( + name: "ix_hubs_post_count", + table: "hubs", + column: "post_count"); + + migrationBuilder.CreateIndex( + name: "ix_locations_full_name", + table: "locations", + column: "full_name"); + + migrationBuilder.CreateIndex( + name: "ix_locations_iso2", + table: "locations", + column: "iso2"); + + migrationBuilder.CreateIndex( + name: "ix_locations_iso3", + table: "locations", + column: "iso3"); + + migrationBuilder.CreateIndex( + name: "ix_locations_lat", + table: "locations", + column: "lat"); + + migrationBuilder.CreateIndex( + name: "ix_locations_lng", + table: "locations", + column: "lng"); + + migrationBuilder.CreateIndex( + name: "ix_locations_name", + table: "locations", + column: "name"); + + migrationBuilder.CreateIndex( + name: "ix_locations_name_ascii", + table: "locations", + column: "name_ascii"); + + migrationBuilder.CreateIndex( + name: "ix_locations_parent_id", + table: "locations", + column: "parent_id"); + + migrationBuilder.CreateIndex( + name: "ix_locations_search_vector", + table: "locations", + column: "search_vector") + .Annotation("Npgsql:IndexMethod", "GIN"); + + migrationBuilder.CreateIndex( + name: "ix_locations_type", + table: "locations", + column: "type"); + + migrationBuilder.CreateIndex( + name: "ix_login_attempts_created_at", + table: "login_attempts", + column: "created_at"); + + migrationBuilder.CreateIndex( + name: "ix_login_attempts_created_ip", + table: "login_attempts", + column: "created_ip"); + + migrationBuilder.CreateIndex( + name: "ix_login_attempts_login_request_id", + table: "login_attempts", + column: "login_request_id"); + + migrationBuilder.CreateIndex( + name: "ix_login_attempts_user_id", + table: "login_attempts", + column: "user_id"); + + migrationBuilder.CreateIndex( + name: "ix_login_requests_created_at", + table: "login_requests", + column: "created_at"); + + migrationBuilder.CreateIndex( + name: "ix_login_requests_created_ip", + table: "login_requests", + column: "created_ip"); + + migrationBuilder.CreateIndex( + name: "ix_login_requests_email", + table: "login_requests", + column: "email"); + + migrationBuilder.CreateIndex( + name: "ix_login_requests_email_code", + table: "login_requests", + column: "email_code"); + + migrationBuilder.CreateIndex( + name: "ix_login_requests_is_used", + table: "login_requests", + column: "is_used"); + + migrationBuilder.CreateIndex( + name: "ix_login_requests_user_id", + table: "login_requests", + column: "user_id"); + + migrationBuilder.CreateIndex( + name: "ix_notifs_created_at", + table: "notifs", + column: "created_at"); + + migrationBuilder.CreateIndex( + name: "ix_notifs_is_read", + table: "notifs", + column: "is_read"); + + migrationBuilder.CreateIndex( + name: "ix_notifs_is_viewed", + table: "notifs", + column: "is_viewed"); + + migrationBuilder.CreateIndex( + name: "ix_notifs_push_notif_sent_at", + table: "notifs", + column: "push_notif_sent_at"); + + migrationBuilder.CreateIndex( + name: "ix_notifs_receiver_user_id", + table: "notifs", + column: "receiver_user_id"); + + migrationBuilder.CreateIndex( + name: "ix_notifs_related_comment_id", + table: "notifs", + column: "related_comment_id"); + + migrationBuilder.CreateIndex( + name: "ix_notifs_related_post_id", + table: "notifs", + column: "related_post_id"); + + migrationBuilder.CreateIndex( + name: "ix_notifs_sender_user_id", + table: "notifs", + column: "sender_user_id"); + + migrationBuilder.CreateIndex( + name: "ix_notifs_type", + table: "notifs", + column: "type"); + + migrationBuilder.CreateIndex( + name: "ix_pm_msgs_thread_id", + table: "pm_msgs", + column: "thread_id"); + + migrationBuilder.CreateIndex( + name: "ix_pm_msgs_thread_user_id", + table: "pm_msgs", + column: "thread_user_id"); + + migrationBuilder.CreateIndex( + name: "ix_pm_msgs_user_id", + table: "pm_msgs", + column: "user_id"); + + migrationBuilder.CreateIndex( + name: "ix_pm_permissions_is_allowed", + table: "pm_permissions", + column: "is_allowed"); + + migrationBuilder.CreateIndex( + name: "ix_pm_permissions_is_blocked", + table: "pm_permissions", + column: "is_blocked"); + + migrationBuilder.CreateIndex( + name: "ix_pm_permissions_sender_user_id", + table: "pm_permissions", + column: "sender_user_id"); + + migrationBuilder.CreateIndex( + name: "ix_pm_thread_users_email_sent_at", + table: "pm_thread_users", + column: "email_sent_at"); + + migrationBuilder.CreateIndex( + name: "ix_pm_thread_users_first_unread_msg_id", + table: "pm_thread_users", + column: "first_unread_msg_id"); + + migrationBuilder.CreateIndex( + name: "ix_pm_thread_users_is_initiator", + table: "pm_thread_users", + column: "is_initiator"); + + migrationBuilder.CreateIndex( + name: "ix_pm_thread_users_last_msg_at", + table: "pm_thread_users", + column: "last_msg_at"); + + migrationBuilder.CreateIndex( + name: "ix_pm_thread_users_last_read_msg_id", + table: "pm_thread_users", + column: "last_read_msg_id"); + + migrationBuilder.CreateIndex( + name: "ix_pm_thread_users_thread_id", + table: "pm_thread_users", + column: "thread_id"); + + migrationBuilder.CreateIndex( + name: "ix_pm_thread_users_unread_msg_count", + table: "pm_thread_users", + column: "unread_msg_count"); + + migrationBuilder.CreateIndex( + name: "ix_pm_thread_users_user_id", + table: "pm_thread_users", + column: "user_id"); + + migrationBuilder.CreateIndex( + name: "ix_pm_threads_created_at", + table: "pm_threads", + column: "created_at"); + + migrationBuilder.CreateIndex( + name: "ix_pm_threads_last_msg_at", + table: "pm_threads", + column: "last_msg_at"); + + migrationBuilder.CreateIndex( + name: "ix_pm_threads_last_msg_id", + table: "pm_threads", + column: "last_msg_id"); + + migrationBuilder.CreateIndex( + name: "ix_post_hubs_hub_id", + table: "post_hubs", + column: "hub_id"); + + migrationBuilder.CreateIndex( + name: "ix_post_medias_clipped_video_id", + table: "post_medias", + column: "clipped_video_id"); + + migrationBuilder.CreateIndex( + name: "ix_post_medias_is_instant", + table: "post_medias", + column: "is_instant"); + + migrationBuilder.CreateIndex( + name: "ix_post_medias_ordering", + table: "post_medias", + column: "ordering"); + + migrationBuilder.CreateIndex( + name: "ix_post_medias_photo_id", + table: "post_medias", + column: "photo_id"); + + migrationBuilder.CreateIndex( + name: "ix_post_medias_post_id", + table: "post_medias", + column: "post_id"); + + migrationBuilder.CreateIndex( + name: "ix_post_medias_preview_photo_id", + table: "post_medias", + column: "preview_photo_id"); + + migrationBuilder.CreateIndex( + name: "ix_post_medias_sub_plan_id", + table: "post_medias", + column: "sub_plan_id"); + + migrationBuilder.CreateIndex( + name: "ix_post_medias_type", + table: "post_medias", + column: "type"); + + migrationBuilder.CreateIndex( + name: "ix_post_medias_video_id", + table: "post_medias", + column: "video_id"); + + migrationBuilder.CreateIndex( + name: "ix_post_notif_batches_created_at", + table: "post_notif_batches", + column: "created_at"); + + migrationBuilder.CreateIndex( + name: "ix_post_notif_batches_is_done", + table: "post_notif_batches", + column: "is_done"); + + migrationBuilder.CreateIndex( + name: "ix_post_views_post_id", + table: "post_views", + column: "post_id"); + + migrationBuilder.CreateIndex( + name: "ix_posts_created_at", + table: "posts", + column: "created_at"); + + migrationBuilder.CreateIndex( + name: "ix_posts_created_ip", + table: "posts", + column: "created_ip"); + + migrationBuilder.CreateIndex( + name: "ix_posts_fav_count", + table: "posts", + column: "fav_count"); + + migrationBuilder.CreateIndex( + name: "ix_posts_is_published", + table: "posts", + column: "is_published"); + + migrationBuilder.CreateIndex( + name: "ix_posts_is_removed", + table: "posts", + column: "is_removed"); + + migrationBuilder.CreateIndex( + name: "ix_posts_user_id", + table: "posts", + column: "user_id"); + + migrationBuilder.CreateIndex( + name: "ix_push_devices_last_used_at", + table: "push_devices", + column: "last_used_at"); + + migrationBuilder.CreateIndex( + name: "ix_push_devices_token", + table: "push_devices", + column: "token"); + + migrationBuilder.CreateIndex( + name: "ix_push_devices_user_id", + table: "push_devices", + column: "user_id"); + + migrationBuilder.CreateIndex( + name: "ix_remote_video_infos_action", + table: "remote_video_infos", + column: "action"); + + migrationBuilder.CreateIndex( + name: "ix_sprites_video_id", + table: "sprites", + column: "video_id"); + + migrationBuilder.CreateIndex( + name: "ix_sub_plans_owner_user_id", + table: "sub_plans", + column: "owner_user_id"); + + migrationBuilder.CreateIndex( + name: "ix_subscriptions_created_ip", + table: "subscriptions", + column: "created_ip"); + + migrationBuilder.CreateIndex( + name: "ix_subscriptions_plan_id", + table: "subscriptions", + column: "plan_id"); + + migrationBuilder.CreateIndex( + name: "ix_subscriptions_user_id", + table: "subscriptions", + column: "user_id"); + + migrationBuilder.CreateIndex( + name: "ix_user_follows_followed_user_id", + table: "user_follows", + column: "followed_user_id"); + + migrationBuilder.CreateIndex( + name: "ix_user_follows_last_new_post_notif_at", + table: "user_follows", + column: "last_new_post_notif_at"); + + migrationBuilder.CreateIndex( + name: "ix_users_created_ip", + table: "users", + column: "created_ip"); + + migrationBuilder.CreateIndex( + name: "ix_users_email", + table: "users", + column: "email"); + + migrationBuilder.CreateIndex( + name: "ix_users_last_notif_check_at", + table: "users", + column: "last_notif_check_at"); + + migrationBuilder.CreateIndex( + name: "ix_users_last_notif_email_at", + table: "users", + column: "last_notif_email_at"); + + migrationBuilder.CreateIndex( + name: "ix_users_last_online_at", + table: "users", + column: "last_online_at"); + + migrationBuilder.CreateIndex( + name: "ix_users_last_pm_check_at", + table: "users", + column: "last_pm_check_at"); + + migrationBuilder.CreateIndex( + name: "ix_users_modified_ip", + table: "users", + column: "modified_ip"); + + migrationBuilder.CreateIndex( + name: "ix_users_notif_email_interval_hours", + table: "users", + column: "notif_email_interval_hours"); + + migrationBuilder.CreateIndex( + name: "ix_users_photo_id", + table: "users", + column: "photo_id"); + + migrationBuilder.CreateIndex( + name: "ix_users_pm_email_interval_hours", + table: "users", + column: "pm_email_interval_hours"); + + migrationBuilder.CreateIndex( + name: "ix_users_role", + table: "users", + column: "role"); + + migrationBuilder.CreateIndex( + name: "ix_users_username", + table: "users", + column: "username", + unique: true); + + migrationBuilder.CreateIndex( + name: "ix_videos_checksum", + table: "videos", + column: "checksum"); + + migrationBuilder.CreateIndex( + name: "ix_videos_reference_domain", + table: "videos", + column: "reference_domain"); + + migrationBuilder.CreateIndex( + name: "ix_videos_reference_id", + table: "videos", + column: "reference_id"); + + migrationBuilder.CreateIndex( + name: "ix_videos_size_in_bytes", + table: "videos", + column: "size_in_bytes"); + + migrationBuilder.AddForeignKey( + name: "fk_pm_msgs_pm_thread_users_thread_user_id", + table: "pm_msgs", + column: "thread_user_id", + principalTable: "pm_thread_users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "fk_pm_msgs_pm_threads_thread_id", + table: "pm_msgs", + column: "thread_id", + principalTable: "pm_threads", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "fk_pm_msgs_users_user_id", + table: "pm_msgs"); + + migrationBuilder.DropForeignKey( + name: "fk_pm_thread_users_users_user_id", + table: "pm_thread_users"); + + migrationBuilder.DropForeignKey( + name: "fk_pm_msgs_pm_thread_users_thread_user_id", + table: "pm_msgs"); + + migrationBuilder.DropForeignKey( + name: "fk_pm_msgs_pm_threads_thread_id", + table: "pm_msgs"); + + migrationBuilder.DropTable( + name: "audit_logs"); + + migrationBuilder.DropTable( + name: "custom_domains"); + + migrationBuilder.DropTable( + name: "english_words"); + + migrationBuilder.DropTable( + name: "fav_posts"); + + migrationBuilder.DropTable( + name: "key_values"); + + migrationBuilder.DropTable( + name: "locations"); + + migrationBuilder.DropTable( + name: "login_attempts"); + + migrationBuilder.DropTable( + name: "notifs"); + + migrationBuilder.DropTable( + name: "pm_permissions"); + + migrationBuilder.DropTable( + name: "post_hubs"); + + migrationBuilder.DropTable( + name: "post_medias"); + + migrationBuilder.DropTable( + name: "post_notif_batches"); + + migrationBuilder.DropTable( + name: "post_views"); + + migrationBuilder.DropTable( + name: "push_devices"); + + migrationBuilder.DropTable( + name: "remote_video_infos"); + + migrationBuilder.DropTable( + name: "sprites"); + + migrationBuilder.DropTable( + name: "subscriptions"); + + migrationBuilder.DropTable( + name: "user_follows"); + + migrationBuilder.DropTable( + name: "login_requests"); + + migrationBuilder.DropTable( + name: "comments"); + + migrationBuilder.DropTable( + name: "hubs"); + + migrationBuilder.DropTable( + name: "videos"); + + migrationBuilder.DropTable( + name: "sub_plans"); + + migrationBuilder.DropTable( + name: "posts"); + + migrationBuilder.DropTable( + name: "users"); + + migrationBuilder.DropTable( + name: "photos"); + + migrationBuilder.DropTable( + name: "pm_thread_users"); + + migrationBuilder.DropTable( + name: "pm_threads"); + + migrationBuilder.DropTable( + name: "pm_msgs"); + } + } +} diff --git a/SwipetorApp/Migrations/DbCxModelSnapshot.cs b/SwipetorApp/Migrations/DbCxModelSnapshot.cs new file mode 100644 index 0000000..9d57dcf --- /dev/null +++ b/SwipetorApp/Migrations/DbCxModelSnapshot.cs @@ -0,0 +1,2148 @@ +// +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using NpgsqlTypes; +using SwipetorApp.Models.DbEntities; + +#nullable disable + +namespace SwipetorApp.Migrations +{ + [DbContext(typeof(DbCx))] + partial class DbCxModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.6") + .HasAnnotation("Proxies:ChangeTracking", false) + .HasAnnotation("Proxies:CheckEquality", false) + .HasAnnotation("Proxies:LazyLoading", true) + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Action") + .HasColumnType("text") + .HasColumnName("action"); + + b.Property("BrowserAgent") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)") + .HasColumnName("browser_agent"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("EntityId") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("entity_id"); + + b.Property("EntityName") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("entity_name"); + + b.Property("Log") + .HasMaxLength(4096) + .HasColumnType("character varying(4096)") + .HasColumnName("log"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_audit_logs"); + + b.HasIndex("Action") + .HasDatabaseName("ix_audit_logs_action"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("ix_audit_logs_created_at"); + + b.HasIndex("CreatedIp") + .HasDatabaseName("ix_audit_logs_created_ip"); + + b.HasIndex("EntityId") + .HasDatabaseName("ix_audit_logs_entity_id"); + + b.HasIndex("EntityName") + .HasDatabaseName("ix_audit_logs_entity_name"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_audit_logs_user_id"); + + b.ToTable("audit_logs", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Comment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("LikeCount") + .HasColumnType("integer") + .HasColumnName("like_count"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("modified_ip"); + + b.Property("PostId") + .HasColumnType("integer") + .HasColumnName("post_id"); + + b.Property("Txt") + .IsRequired() + .HasMaxLength(65536) + .HasColumnType("character varying(65536)") + .HasColumnName("txt"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_comments"); + + b.HasIndex("LikeCount") + .HasDatabaseName("ix_comments_like_count"); + + b.HasIndex("PostId") + .HasDatabaseName("ix_comments_post_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_comments_user_id"); + + b.ToTable("comments", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.CustomDomain", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DomainName") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("domain_name"); + + b.Property("RecaptchaKey") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("recaptcha_key"); + + b.Property("RecaptchaSecret") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("recaptcha_secret"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_custom_domains"); + + b.HasIndex("DomainName") + .HasDatabaseName("ix_custom_domains_domain_name"); + + b.HasIndex("UserId") + .IsUnique() + .HasDatabaseName("ix_custom_domains_user_id"); + + b.ToTable("custom_domains", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.EnglishWord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Word") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("word"); + + b.HasKey("Id") + .HasName("pk_english_words"); + + b.ToTable("english_words", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.FavPost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("PostId") + .HasColumnType("integer") + .HasColumnName("post_id"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_fav_posts"); + + b.HasIndex("PostId") + .HasDatabaseName("ix_fav_posts_post_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_fav_posts_user_id"); + + b.ToTable("fav_posts", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Hub", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("LastPostAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_post_at"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("character varying(32)") + .HasColumnName("name"); + + b.Property("Ordering") + .HasColumnType("integer") + .HasColumnName("ordering"); + + b.Property("PhotoId") + .HasColumnType("uuid") + .HasColumnName("photo_id"); + + b.Property("PostCount") + .HasColumnType("integer") + .HasColumnName("post_count"); + + b.HasKey("Id") + .HasName("pk_hubs"); + + b.HasIndex("LastPostAt") + .HasDatabaseName("ix_hubs_last_post_at"); + + b.HasIndex("Ordering") + .HasDatabaseName("ix_hubs_ordering"); + + b.HasIndex("PhotoId") + .HasDatabaseName("ix_hubs_photo_id"); + + b.HasIndex("PostCount") + .HasDatabaseName("ix_hubs_post_count"); + + b.ToTable("hubs", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.KeyValue", b => + { + b.Property("Key") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("key"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("ModifiedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("modified_ip"); + + b.Property("Value") + .HasMaxLength(4096) + .HasColumnType("character varying(4096)") + .HasColumnName("value"); + + b.HasKey("Key") + .HasName("pk_key_values"); + + b.ToTable("key_values", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Capital") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("capital"); + + b.Property("FullName") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("full_name"); + + b.Property("Iso2") + .HasMaxLength(2) + .HasColumnType("character varying(2)") + .HasColumnName("iso2"); + + b.Property("Iso3") + .HasMaxLength(3) + .HasColumnType("character varying(3)") + .HasColumnName("iso3"); + + b.Property("Lat") + .HasColumnType("double precision") + .HasColumnName("lat"); + + b.Property("Lng") + .HasColumnType("double precision") + .HasColumnName("lng"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("name"); + + b.Property("NameAscii") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("name_ascii"); + + b.Property("ParentId") + .HasColumnType("integer") + .HasColumnName("parent_id"); + + b.Property("Population") + .HasColumnType("integer") + .HasColumnName("population"); + + b.Property("SearchVector") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("tsvector") + .HasColumnName("search_vector") + .HasAnnotation("Npgsql:TsVectorConfig", "english") + .HasAnnotation("Npgsql:TsVectorProperties", new[] { "Name", "NameAscii", "FullName" }); + + b.Property("SimplemapsId") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("simplemaps_id"); + + b.Property("Type") + .HasColumnType("integer") + .HasColumnName("type"); + + b.HasKey("Id") + .HasName("pk_locations"); + + b.HasIndex("FullName") + .HasDatabaseName("ix_locations_full_name"); + + b.HasIndex("Iso2") + .HasDatabaseName("ix_locations_iso2"); + + b.HasIndex("Iso3") + .HasDatabaseName("ix_locations_iso3"); + + b.HasIndex("Lat") + .HasDatabaseName("ix_locations_lat"); + + b.HasIndex("Lng") + .HasDatabaseName("ix_locations_lng"); + + b.HasIndex("Name") + .HasDatabaseName("ix_locations_name"); + + b.HasIndex("NameAscii") + .HasDatabaseName("ix_locations_name_ascii"); + + b.HasIndex("ParentId") + .HasDatabaseName("ix_locations_parent_id"); + + b.HasIndex("SearchVector") + .HasDatabaseName("ix_locations_search_vector"); + + NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); + + b.HasIndex("Type") + .HasDatabaseName("ix_locations_type"); + + b.ToTable("locations", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.LoginAttempt", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("BrowserAgent") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)") + .HasColumnName("browser_agent"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("LoginRequestId") + .HasColumnType("uuid") + .HasColumnName("login_request_id"); + + b.Property("TriedEmailCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("tried_email_code"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_login_attempts"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("ix_login_attempts_created_at"); + + b.HasIndex("CreatedIp") + .HasDatabaseName("ix_login_attempts_created_ip"); + + b.HasIndex("LoginRequestId") + .HasDatabaseName("ix_login_attempts_login_request_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_login_attempts_user_id"); + + b.ToTable("login_attempts", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.LoginRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("BrowserAgent") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)") + .HasColumnName("browser_agent"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("Email") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("email"); + + b.Property("EmailCode") + .HasMaxLength(32) + .HasColumnType("character varying(32)") + .HasColumnName("email_code"); + + b.Property("IsUsed") + .HasColumnType("boolean") + .HasColumnName("is_used"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_login_requests"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("ix_login_requests_created_at"); + + b.HasIndex("CreatedIp") + .HasDatabaseName("ix_login_requests_created_ip"); + + b.HasIndex("Email") + .HasDatabaseName("ix_login_requests_email"); + + b.HasIndex("EmailCode") + .HasDatabaseName("ix_login_requests_email_code"); + + b.HasIndex("IsUsed") + .HasDatabaseName("ix_login_requests_is_used"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_login_requests_user_id"); + + b.ToTable("login_requests", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Notif", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("Data") + .HasMaxLength(4096) + .HasColumnType("character varying(4096)") + .HasColumnName("data"); + + b.Property("IsRead") + .HasColumnType("boolean") + .HasColumnName("is_read"); + + b.Property("IsViewed") + .HasColumnType("boolean") + .HasColumnName("is_viewed"); + + b.Property("PushNotifSentAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("push_notif_sent_at"); + + b.Property("ReceiverUserId") + .HasColumnType("integer") + .HasColumnName("receiver_user_id"); + + b.Property("RelatedCommentId") + .HasColumnType("integer") + .HasColumnName("related_comment_id"); + + b.Property("RelatedPostId") + .HasColumnType("integer") + .HasColumnName("related_post_id"); + + b.Property("SenderUserId") + .HasColumnType("integer") + .HasColumnName("sender_user_id"); + + b.Property("Type") + .HasColumnType("integer") + .HasColumnName("type"); + + b.HasKey("Id") + .HasName("pk_notifs"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("ix_notifs_created_at"); + + b.HasIndex("IsRead") + .HasDatabaseName("ix_notifs_is_read"); + + b.HasIndex("IsViewed") + .HasDatabaseName("ix_notifs_is_viewed"); + + b.HasIndex("PushNotifSentAt") + .HasDatabaseName("ix_notifs_push_notif_sent_at"); + + b.HasIndex("ReceiverUserId") + .HasDatabaseName("ix_notifs_receiver_user_id"); + + b.HasIndex("RelatedCommentId") + .HasDatabaseName("ix_notifs_related_comment_id"); + + b.HasIndex("RelatedPostId") + .HasDatabaseName("ix_notifs_related_post_id"); + + b.HasIndex("SenderUserId") + .HasDatabaseName("ix_notifs_sender_user_id"); + + b.HasIndex("Type") + .HasDatabaseName("ix_notifs_type"); + + b.ToTable("notifs", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Photo", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("Ext") + .HasMaxLength(8) + .HasColumnType("character varying(8)") + .HasColumnName("ext"); + + b.Property("Height") + .HasColumnType("integer") + .HasColumnName("height"); + + b.Property("ReferenceUrl") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("reference_url"); + + b.Property>("Sizes") + .HasColumnType("integer[]") + .HasColumnName("sizes"); + + b.Property("Width") + .HasColumnType("integer") + .HasColumnName("width"); + + b.HasKey("Id") + .HasName("pk_photos"); + + b.ToTable("photos", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PmMsg", 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("ThreadId") + .HasColumnType("bigint") + .HasColumnName("thread_id"); + + b.Property("ThreadUserId") + .HasColumnType("integer") + .HasColumnName("thread_user_id"); + + b.Property("Txt") + .HasMaxLength(65536) + .HasColumnType("character varying(65536)") + .HasColumnName("txt"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_pm_msgs"); + + b.HasIndex("ThreadId") + .HasDatabaseName("ix_pm_msgs_thread_id"); + + b.HasIndex("ThreadUserId") + .HasDatabaseName("ix_pm_msgs_thread_user_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_pm_msgs_user_id"); + + b.ToTable("pm_msgs", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PmPermission", b => + { + b.Property("ReceiverUserId") + .HasColumnType("integer") + .HasColumnName("receiver_user_id"); + + b.Property("SenderUserId") + .HasColumnType("integer") + .HasColumnName("sender_user_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("IsAllowed") + .HasColumnType("boolean") + .HasColumnName("is_allowed"); + + b.Property("IsBlocked") + .HasColumnType("boolean") + .HasColumnName("is_blocked"); + + b.HasKey("ReceiverUserId", "SenderUserId") + .HasName("pk_pm_permissions"); + + b.HasIndex("IsAllowed") + .HasDatabaseName("ix_pm_permissions_is_allowed"); + + b.HasIndex("IsBlocked") + .HasDatabaseName("ix_pm_permissions_is_blocked"); + + b.HasIndex("SenderUserId") + .HasDatabaseName("ix_pm_permissions_sender_user_id"); + + b.ToTable("pm_permissions", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PmThread", 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("LastMsgAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_msg_at"); + + b.Property("LastMsgId") + .HasColumnType("bigint") + .HasColumnName("last_msg_id"); + + b.Property("UserCount") + .HasColumnType("integer") + .HasColumnName("user_count"); + + b.HasKey("Id") + .HasName("pk_pm_threads"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("ix_pm_threads_created_at"); + + b.HasIndex("LastMsgAt") + .HasDatabaseName("ix_pm_threads_last_msg_at"); + + b.HasIndex("LastMsgId") + .HasDatabaseName("ix_pm_threads_last_msg_id"); + + b.ToTable("pm_threads", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PmThreadUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("EmailSentAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("email_sent_at"); + + b.Property("FirstUnreadMsgId") + .HasColumnType("bigint") + .HasColumnName("first_unread_msg_id"); + + b.Property("IsInitiator") + .HasColumnType("boolean") + .HasColumnName("is_initiator"); + + b.Property("LastMsgAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_msg_at"); + + b.Property("LastReadMsgId") + .HasColumnType("bigint") + .HasColumnName("last_read_msg_id"); + + b.Property("ThreadId") + .HasColumnType("bigint") + .HasColumnName("thread_id"); + + b.Property("UnreadMsgCount") + .HasColumnType("integer") + .HasColumnName("unread_msg_count"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_pm_thread_users"); + + b.HasIndex("EmailSentAt") + .HasDatabaseName("ix_pm_thread_users_email_sent_at"); + + b.HasIndex("FirstUnreadMsgId") + .HasDatabaseName("ix_pm_thread_users_first_unread_msg_id"); + + b.HasIndex("IsInitiator") + .HasDatabaseName("ix_pm_thread_users_is_initiator"); + + b.HasIndex("LastMsgAt") + .HasDatabaseName("ix_pm_thread_users_last_msg_at"); + + b.HasIndex("LastReadMsgId") + .HasDatabaseName("ix_pm_thread_users_last_read_msg_id"); + + b.HasIndex("ThreadId") + .HasDatabaseName("ix_pm_thread_users_thread_id"); + + b.HasIndex("UnreadMsgCount") + .HasDatabaseName("ix_pm_thread_users_unread_msg_count"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_pm_thread_users_user_id"); + + b.ToTable("pm_thread_users", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Post", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CommentsCount") + .HasColumnType("integer") + .HasColumnName("comments_count"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("FavCount") + .HasColumnType("integer") + .HasColumnName("fav_count"); + + b.Property("IsPublished") + .HasColumnType("boolean") + .HasColumnName("is_published"); + + b.Property("IsRemoved") + .HasColumnType("boolean") + .HasColumnName("is_removed"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("Title") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("title"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_posts"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("ix_posts_created_at"); + + b.HasIndex("CreatedIp") + .HasDatabaseName("ix_posts_created_ip"); + + b.HasIndex("FavCount") + .HasDatabaseName("ix_posts_fav_count"); + + b.HasIndex("IsPublished") + .HasDatabaseName("ix_posts_is_published"); + + b.HasIndex("IsRemoved") + .HasDatabaseName("ix_posts_is_removed"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_posts_user_id"); + + b.ToTable("posts", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PostHub", b => + { + b.Property("PostId") + .HasColumnType("integer") + .HasColumnName("post_id"); + + b.Property("HubId") + .HasColumnType("integer") + .HasColumnName("hub_id"); + + b.HasKey("PostId", "HubId") + .HasName("pk_post_hubs"); + + b.HasIndex("HubId") + .HasDatabaseName("ix_post_hubs_hub_id"); + + b.ToTable("post_hubs", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PostMedia", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Article") + .HasMaxLength(1024000) + .HasColumnType("character varying(1024000)") + .HasColumnName("article"); + + b.Property("ClipTimes") + .HasColumnType("text") + .HasColumnName("clip_times"); + + b.Property("ClippedVideoId") + .HasColumnType("uuid") + .HasColumnName("clipped_video_id"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("character varying(512)") + .HasColumnName("description"); + + b.Property("IsFollowersOnly") + .HasColumnType("boolean") + .HasColumnName("is_followers_only"); + + b.Property("IsInstant") + .HasColumnType("boolean") + .HasColumnName("is_instant"); + + b.Property("Ordering") + .HasColumnType("integer") + .HasColumnName("ordering"); + + b.Property("PhotoId") + .HasColumnType("uuid") + .HasColumnName("photo_id"); + + b.Property("PostId") + .HasColumnType("integer") + .HasColumnName("post_id"); + + b.Property("PreviewPhotoId") + .HasColumnType("uuid") + .HasColumnName("preview_photo_id"); + + b.Property("PreviewPhotoTime") + .HasColumnType("double precision") + .HasColumnName("preview_photo_time"); + + b.Property("SubPlanId") + .HasColumnType("integer") + .HasColumnName("sub_plan_id"); + + b.Property("Type") + .HasColumnType("integer") + .HasColumnName("type"); + + b.Property("VideoId") + .HasColumnType("uuid") + .HasColumnName("video_id"); + + b.HasKey("Id") + .HasName("pk_post_medias"); + + b.HasIndex("ClippedVideoId") + .HasDatabaseName("ix_post_medias_clipped_video_id"); + + b.HasIndex("IsInstant") + .HasDatabaseName("ix_post_medias_is_instant"); + + b.HasIndex("Ordering") + .HasDatabaseName("ix_post_medias_ordering"); + + b.HasIndex("PhotoId") + .HasDatabaseName("ix_post_medias_photo_id"); + + b.HasIndex("PostId") + .HasDatabaseName("ix_post_medias_post_id"); + + b.HasIndex("PreviewPhotoId") + .HasDatabaseName("ix_post_medias_preview_photo_id"); + + b.HasIndex("SubPlanId") + .HasDatabaseName("ix_post_medias_sub_plan_id"); + + b.HasIndex("Type") + .HasDatabaseName("ix_post_medias_type"); + + b.HasIndex("VideoId") + .HasDatabaseName("ix_post_medias_video_id"); + + b.ToTable("post_medias", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PostNotifBatch", b => + { + b.Property("PostId") + .HasColumnType("integer") + .HasColumnName("post_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("IsDone") + .HasColumnType("boolean") + .HasColumnName("is_done"); + + b.Property("ProcessedCount") + .HasColumnType("integer") + .HasColumnName("processed_count"); + + b.HasKey("PostId") + .HasName("pk_post_notif_batches"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("ix_post_notif_batches_created_at"); + + b.HasIndex("IsDone") + .HasDatabaseName("ix_post_notif_batches_is_done"); + + b.ToTable("post_notif_batches", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PostView", b => + { + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.Property("PostId") + .HasColumnType("integer") + .HasColumnName("post_id"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("ViewedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("viewed_at"); + + b.HasKey("UserId", "PostId") + .HasName("pk_post_views"); + + b.HasIndex("PostId") + .HasDatabaseName("ix_post_views_post_id"); + + b.ToTable("post_views", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PushDevice", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("LastUsedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_used_at"); + + b.Property("Token") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("token"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_push_devices"); + + b.HasIndex("LastUsedAt") + .HasDatabaseName("ix_push_devices_last_used_at"); + + b.HasIndex("Token") + .HasDatabaseName("ix_push_devices_token"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_push_devices_user_id"); + + b.ToTable("push_devices", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.RemoteVideoInfo", b => + { + b.Property("RefDomain") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("ref_domain"); + + b.Property("RefId") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("ref_id"); + + b.Property("Action") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("action"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("ExtraInfo") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("extra_info"); + + b.HasKey("RefDomain", "RefId") + .HasName("pk_remote_video_infos"); + + b.HasIndex("Action") + .HasDatabaseName("ix_remote_video_infos_action"); + + b.ToTable("remote_video_infos", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Sprite", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Interval") + .HasColumnType("double precision") + .HasColumnName("interval"); + + b.Property("StartTime") + .HasColumnType("double precision") + .HasColumnName("start_time"); + + b.Property("ThumbnailCount") + .HasColumnType("integer") + .HasColumnName("thumbnail_count"); + + b.Property("ThumbnailHeight") + .HasColumnType("integer") + .HasColumnName("thumbnail_height"); + + b.Property("ThumbnailWidth") + .HasColumnType("integer") + .HasColumnName("thumbnail_width"); + + b.Property("VideoId") + .HasColumnType("uuid") + .HasColumnName("video_id"); + + b.HasKey("Id") + .HasName("pk_sprites"); + + b.HasIndex("VideoId") + .HasDatabaseName("ix_sprites_video_id"); + + b.ToTable("sprites", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Sub", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("BrowserAgent") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)") + .HasColumnName("browser_agent"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("EndedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("ended_at"); + + b.Property("IsActive") + .HasColumnType("boolean") + .HasColumnName("is_active"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("modified_at"); + + b.Property("PlanId") + .HasColumnType("integer") + .HasColumnName("plan_id"); + + b.Property("StartedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("started_at"); + + b.Property("UserId") + .HasColumnType("integer") + .HasColumnName("user_id"); + + b.HasKey("Id") + .HasName("pk_subscriptions"); + + b.HasIndex("CreatedIp") + .HasDatabaseName("ix_subscriptions_created_ip"); + + b.HasIndex("PlanId") + .HasDatabaseName("ix_subscriptions_plan_id"); + + b.HasIndex("UserId") + .HasDatabaseName("ix_subscriptions_user_id"); + + b.ToTable("subscriptions", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.SubPlan", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Currency") + .HasColumnType("text") + .HasColumnName("currency"); + + b.Property("Description") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("description"); + + b.Property("Name") + .HasMaxLength(30) + .HasColumnType("character varying(30)") + .HasColumnName("name"); + + b.Property("OwnerUserId") + .HasColumnType("integer") + .HasColumnName("owner_user_id"); + + b.Property("Price") + .HasColumnType("numeric") + .HasColumnName("price"); + + b.HasKey("Id") + .HasName("pk_sub_plans"); + + b.HasIndex("OwnerUserId") + .HasDatabaseName("ix_sub_plans_owner_user_id"); + + b.ToTable("sub_plans", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("BrowserAgent") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)") + .HasColumnName("browser_agent"); + + b.Property("CommentCount") + .HasColumnType("integer") + .HasColumnName("comment_count"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("description"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("email"); + + b.Property("LastNotifCheckAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_notif_check_at"); + + b.Property("LastNotifEmailAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_notif_email_at"); + + b.Property("LastOnlineAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_online_at"); + + b.Property("LastOnlineIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("last_online_ip"); + + b.Property("LastPmCheckAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_pm_check_at"); + + b.Property("ModifiedIp") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("modified_ip"); + + b.Property("NotifEmailIntervalHours") + .HasColumnType("integer") + .HasColumnName("notif_email_interval_hours"); + + b.Property("PhotoId") + .HasColumnType("uuid") + .HasColumnName("photo_id"); + + b.Property("PmEmailIntervalHours") + .HasColumnType("integer") + .HasColumnName("pm_email_interval_hours"); + + b.Property("PremiumUntil") + .HasColumnType("timestamp with time zone") + .HasColumnName("premium_until"); + + b.Property("RobotSource") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("robot_source"); + + b.Property("Role") + .HasColumnType("integer") + .HasColumnName("role"); + + b.Property("Secret") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("character varying(16)") + .HasColumnName("secret"); + + b.Property("Username") + .HasMaxLength(18) + .HasColumnType("character varying(18)") + .HasColumnName("username"); + + b.HasKey("Id") + .HasName("pk_users"); + + b.HasIndex("CreatedIp") + .HasDatabaseName("ix_users_created_ip"); + + b.HasIndex("Email") + .HasDatabaseName("ix_users_email"); + + b.HasIndex("LastNotifCheckAt") + .HasDatabaseName("ix_users_last_notif_check_at"); + + b.HasIndex("LastNotifEmailAt") + .HasDatabaseName("ix_users_last_notif_email_at"); + + b.HasIndex("LastOnlineAt") + .HasDatabaseName("ix_users_last_online_at"); + + b.HasIndex("LastPmCheckAt") + .HasDatabaseName("ix_users_last_pm_check_at"); + + b.HasIndex("ModifiedIp") + .HasDatabaseName("ix_users_modified_ip"); + + b.HasIndex("NotifEmailIntervalHours") + .HasDatabaseName("ix_users_notif_email_interval_hours"); + + b.HasIndex("PhotoId") + .HasDatabaseName("ix_users_photo_id"); + + b.HasIndex("PmEmailIntervalHours") + .HasDatabaseName("ix_users_pm_email_interval_hours"); + + b.HasIndex("Role") + .HasDatabaseName("ix_users_role"); + + b.HasIndex("Username") + .IsUnique() + .HasDatabaseName("ix_users_username"); + + b.ToTable("users", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.UserFollow", b => + { + b.Property("FollowerUserId") + .HasColumnType("integer") + .HasColumnName("follower_user_id"); + + b.Property("FollowedUserId") + .HasColumnType("integer") + .HasColumnName("followed_user_id"); + + b.Property("LastNewPostNotifAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_new_post_notif_at"); + + b.HasKey("FollowerUserId", "FollowedUserId") + .HasName("pk_user_follows"); + + b.HasIndex("FollowedUserId") + .HasDatabaseName("ix_user_follows_followed_user_id"); + + b.HasIndex("LastNewPostNotifAt") + .HasDatabaseName("ix_user_follows_last_new_post_notif_at"); + + b.ToTable("user_follows", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Video", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Captions") + .HasMaxLength(102400) + .HasColumnType("character varying(102400)") + .HasColumnName("captions"); + + b.Property("Checksum") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("checksum"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("CreatedIp") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("created_ip"); + + b.Property("Duration") + .HasColumnType("double precision") + .HasColumnName("duration"); + + b.Property("Ext") + .HasMaxLength(8) + .HasColumnType("character varying(8)") + .HasColumnName("ext"); + + b.Property("Formats") + .HasColumnType("jsonb") + .HasColumnName("formats"); + + b.Property("Height") + .HasColumnType("integer") + .HasColumnName("height"); + + b.Property("ReferenceDesc") + .HasMaxLength(102400) + .HasColumnType("character varying(102400)") + .HasColumnName("reference_desc"); + + b.Property("ReferenceDomain") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("reference_domain"); + + b.Property("ReferenceId") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("reference_id"); + + b.Property("ReferenceJson") + .HasMaxLength(1024000) + .HasColumnType("character varying(1024000)") + .HasColumnName("reference_json"); + + b.Property("ReferenceTitle") + .HasMaxLength(512) + .HasColumnType("character varying(512)") + .HasColumnName("reference_title"); + + b.Property("ReferenceUrl") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("reference_url"); + + b.Property("SizeInBytes") + .HasColumnType("bigint") + .HasColumnName("size_in_bytes"); + + b.Property("Width") + .HasColumnType("integer") + .HasColumnName("width"); + + b.HasKey("Id") + .HasName("pk_videos"); + + b.HasIndex("Checksum") + .HasDatabaseName("ix_videos_checksum"); + + b.HasIndex("ReferenceDomain") + .HasDatabaseName("ix_videos_reference_domain"); + + b.HasIndex("ReferenceId") + .HasDatabaseName("ix_videos_reference_id"); + + b.HasIndex("SizeInBytes") + .HasDatabaseName("ix_videos_size_in_bytes"); + + b.ToTable("videos", (string)null); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.AuditLog", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_audit_logs_users_user_id"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Comment", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.Post", "Post") + .WithMany("Comments") + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_comments_posts_post_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_comments_users_user_id"); + + b.Navigation("Post"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.CustomDomain", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithOne("CustomDomain") + .HasForeignKey("SwipetorApp.Models.DbEntities.CustomDomain", "UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_custom_domains_users_user_id"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.FavPost", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.Post", "Post") + .WithMany("Favs") + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_fav_posts_posts_post_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_fav_posts_users_user_id"); + + b.Navigation("Post"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Hub", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.Photo", "Photo") + .WithMany() + .HasForeignKey("PhotoId") + .HasConstraintName("fk_hubs_photos_photo_id"); + + b.Navigation("Photo"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Location", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.Location", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId") + .HasConstraintName("fk_locations_locations_parent_id"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.LoginAttempt", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.LoginRequest", "LoginRequest") + .WithMany() + .HasForeignKey("LoginRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_login_attempts_login_requests_login_request_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .HasConstraintName("fk_login_attempts_users_user_id"); + + b.Navigation("LoginRequest"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.LoginRequest", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .HasConstraintName("fk_login_requests_users_user_id"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Notif", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.User", "ReceiverUser") + .WithMany("Notifs") + .HasForeignKey("ReceiverUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_notifs_users_receiver_user_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.Comment", "RelatedComment") + .WithMany() + .HasForeignKey("RelatedCommentId") + .HasConstraintName("fk_notifs_comments_related_comment_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.Post", "RelatedPost") + .WithMany() + .HasForeignKey("RelatedPostId") + .HasConstraintName("fk_notifs_posts_related_post_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.User", "SenderUser") + .WithMany() + .HasForeignKey("SenderUserId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_notifs_users_sender_user_id"); + + b.Navigation("ReceiverUser"); + + b.Navigation("RelatedComment"); + + b.Navigation("RelatedPost"); + + b.Navigation("SenderUser"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PmMsg", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.PmThread", "Thread") + .WithMany("Msgs") + .HasForeignKey("ThreadId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_pm_msgs_pm_threads_thread_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.PmThreadUser", "ThreadUser") + .WithMany("Msgs") + .HasForeignKey("ThreadUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_pm_msgs_pm_thread_users_thread_user_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_pm_msgs_users_user_id"); + + b.Navigation("Thread"); + + b.Navigation("ThreadUser"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PmPermission", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.User", "ReceiverUser") + .WithMany() + .HasForeignKey("ReceiverUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_pm_permissions_users_receiver_user_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.User", "SenderUser") + .WithMany() + .HasForeignKey("SenderUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_pm_permissions_users_sender_user_id"); + + b.Navigation("ReceiverUser"); + + b.Navigation("SenderUser"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PmThread", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.PmMsg", "LastMsg") + .WithMany() + .HasForeignKey("LastMsgId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_pm_threads_pm_msgs_last_msg_id"); + + b.Navigation("LastMsg"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PmThreadUser", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.PmMsg", "FirstUnreadMsg") + .WithMany() + .HasForeignKey("FirstUnreadMsgId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_pm_thread_users_pm_msgs_first_unread_msg_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.PmMsg", "LastReadMsg") + .WithMany() + .HasForeignKey("LastReadMsgId") + .OnDelete(DeleteBehavior.Cascade) + .HasConstraintName("fk_pm_thread_users_pm_msgs_last_read_msg_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.PmThread", "Thread") + .WithMany("ThreadUsers") + .HasForeignKey("ThreadId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_pm_thread_users_pm_threads_thread_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithMany("PmThreadUsers") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_pm_thread_users_users_user_id"); + + b.Navigation("FirstUnreadMsg"); + + b.Navigation("LastReadMsg"); + + b.Navigation("Thread"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Post", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithMany("Posts") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_posts_users_user_id"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PostHub", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.Hub", "Hub") + .WithMany("PostHubs") + .HasForeignKey("HubId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_post_hubs_hubs_hub_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.Post", "Post") + .WithMany("PostHubs") + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_post_hubs_posts_post_id"); + + b.Navigation("Hub"); + + b.Navigation("Post"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PostMedia", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.Video", "ClippedVideo") + .WithMany() + .HasForeignKey("ClippedVideoId") + .HasConstraintName("fk_post_medias_videos_clipped_video_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.Photo", "Photo") + .WithMany() + .HasForeignKey("PhotoId") + .HasConstraintName("fk_post_medias_photos_photo_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.Post", "Post") + .WithMany("Medias") + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_post_medias_posts_post_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.Photo", "PreviewPhoto") + .WithMany() + .HasForeignKey("PreviewPhotoId") + .HasConstraintName("fk_post_medias_photos_preview_photo_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.SubPlan", "SubPlan") + .WithMany() + .HasForeignKey("SubPlanId") + .HasConstraintName("fk_post_medias_sub_plans_sub_plan_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.Video", "Video") + .WithMany() + .HasForeignKey("VideoId") + .HasConstraintName("fk_post_medias_videos_video_id"); + + b.Navigation("ClippedVideo"); + + b.Navigation("Photo"); + + b.Navigation("Post"); + + b.Navigation("PreviewPhoto"); + + b.Navigation("SubPlan"); + + b.Navigation("Video"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PostNotifBatch", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.Post", "Post") + .WithOne("NotifBatch") + .HasForeignKey("SwipetorApp.Models.DbEntities.PostNotifBatch", "PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_post_notif_batches_posts_post_id"); + + b.Navigation("Post"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PostView", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.Post", "Post") + .WithMany("PostViews") + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_post_views_posts_post_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_post_views_users_user_id"); + + b.Navigation("Post"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PushDevice", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithMany("PushDevices") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_push_devices_users_user_id"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Sprite", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.Video", "Video") + .WithMany("Sprites") + .HasForeignKey("VideoId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_sprites_videos_video_id"); + + b.Navigation("Video"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Sub", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.SubPlan", "Plan") + .WithMany("Subscriptions") + .HasForeignKey("PlanId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_subscriptions_sub_plans_plan_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.User", "User") + .WithMany("Subscriptions") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_subscriptions_users_user_id"); + + b.Navigation("Plan"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.SubPlan", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.User", "OwnerUser") + .WithMany("OwnedSubscriptionPlans") + .HasForeignKey("OwnerUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_sub_plans_users_owner_user_id"); + + b.Navigation("OwnerUser"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.User", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.Photo", "Photo") + .WithMany() + .HasForeignKey("PhotoId") + .HasConstraintName("fk_users_photos_photo_id"); + + b.Navigation("Photo"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.UserFollow", b => + { + b.HasOne("SwipetorApp.Models.DbEntities.User", "FollowedUser") + .WithMany("Followers") + .HasForeignKey("FollowedUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_user_follows_users_followed_user_id"); + + b.HasOne("SwipetorApp.Models.DbEntities.User", "FollowerUser") + .WithMany("Following") + .HasForeignKey("FollowerUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("fk_user_follows_users_follower_user_id"); + + b.Navigation("FollowedUser"); + + b.Navigation("FollowerUser"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Hub", b => + { + b.Navigation("PostHubs"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Location", b => + { + b.Navigation("Children"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PmThread", b => + { + b.Navigation("Msgs"); + + b.Navigation("ThreadUsers"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.PmThreadUser", b => + { + b.Navigation("Msgs"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Post", b => + { + b.Navigation("Comments"); + + b.Navigation("Favs"); + + b.Navigation("Medias"); + + b.Navigation("NotifBatch"); + + b.Navigation("PostHubs"); + + b.Navigation("PostViews"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.SubPlan", b => + { + b.Navigation("Subscriptions"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.User", b => + { + b.Navigation("CustomDomain"); + + b.Navigation("Followers"); + + b.Navigation("Following"); + + b.Navigation("Notifs"); + + b.Navigation("OwnedSubscriptionPlans"); + + b.Navigation("PmThreadUsers"); + + b.Navigation("Posts"); + + b.Navigation("PushDevices"); + + b.Navigation("Subscriptions"); + }); + + modelBuilder.Entity("SwipetorApp.Models.DbEntities.Video", b => + { + b.Navigation("Sprites"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/SwipetorApp/Services/SqlQueries/Models/UserQueryModel.cs b/SwipetorApp/Services/SqlQueries/Models/UserQueryModel.cs index c57ecc0..9740523 100644 --- a/SwipetorApp/Services/SqlQueries/Models/UserQueryModel.cs +++ b/SwipetorApp/Services/SqlQueries/Models/UserQueryModel.cs @@ -1,5 +1,4 @@ -using SwipetorApp.Migrations; -using SwipetorApp.Models.DbEntities; +using SwipetorApp.Models.DbEntities; namespace SwipetorApp.Services.SqlQueries.Models;