Skip to content

Instantly share code, notes, and snippets.

@jadsongmatos
Created May 7, 2025 03:43
Show Gist options
  • Save jadsongmatos/ee00100a4ba6fe46d421ff8c23af7b29 to your computer and use it in GitHub Desktop.
Save jadsongmatos/ee00100a4ba6fe46d421ff8c23af7b29 to your computer and use it in GitHub Desktop.
-- accounts_tags definição
CREATE TABLE "accounts_tags" ("account_id" bigint NOT NULL, "tag_id" bigint NOT NULL, PRIMARY KEY ("tag_id", "account_id"));
CREATE INDEX "index_accounts_tags_on_account_id_and_tag_id" ON "accounts_tags" ("account_id", "tag_id");
-- account_warning_presets definição
CREATE TABLE "account_warning_presets" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "text" text DEFAULT '' NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "title" varchar DEFAULT '' NOT NULL);
-- announcements definição
CREATE TABLE "announcements" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "text" text DEFAULT '' NOT NULL, "published" boolean DEFAULT 0 NOT NULL, "all_day" boolean DEFAULT 0 NOT NULL, "scheduled_at" datetime, "starts_at" datetime, "ends_at" datetime, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "published_at" datetime, "status_ids" bigint DEFAULT NULL, "notification_sent_at" datetime(6));
-- annual_report_statuses_per_account_counts definição
CREATE TABLE "annual_report_statuses_per_account_counts" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "year" integer NOT NULL, "account_id" bigint NOT NULL, "statuses_count" bigint NOT NULL);
CREATE UNIQUE INDEX "idx_on_year_account_id_ff3e167cef" ON "annual_report_statuses_per_account_counts" ("year", "account_id");
-- ar_internal_metadata definição
CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL);
-- conversations definição
CREATE TABLE "conversations" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "uri" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL);
CREATE UNIQUE INDEX "index_conversations_on_uri" ON "conversations" ("uri") WHERE (uri IS NOT NULL);
-- custom_emojis definição
CREATE TABLE "custom_emojis" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "shortcode" varchar DEFAULT '' NOT NULL, "domain" varchar, "image_file_name" varchar, "image_content_type" varchar, "image_file_size" integer, "image_updated_at" datetime, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "disabled" boolean DEFAULT 0 NOT NULL, "uri" varchar, "image_remote_url" varchar, "visible_in_picker" boolean DEFAULT 1 NOT NULL, "category_id" bigint, "image_storage_schema_version" integer);
CREATE UNIQUE INDEX "index_custom_emojis_on_shortcode_and_domain" ON "custom_emojis" ("shortcode", "domain");
-- custom_emoji_categories definição
CREATE TABLE "custom_emoji_categories" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL);
CREATE UNIQUE INDEX "index_custom_emoji_categories_on_name" ON "custom_emoji_categories" ("name");
-- domain_allows definição
CREATE TABLE "domain_allows" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "domain" varchar DEFAULT '' NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL);
CREATE UNIQUE INDEX "index_domain_allows_on_domain" ON "domain_allows" ("domain");
-- domain_blocks definição
CREATE TABLE "domain_blocks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "domain" varchar DEFAULT '' NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "severity" integer DEFAULT 0, "reject_media" boolean DEFAULT 0 NOT NULL, "reject_reports" boolean DEFAULT 0 NOT NULL, "private_comment" text, "public_comment" text, "obfuscate" boolean DEFAULT 0 NOT NULL);
CREATE UNIQUE INDEX "index_domain_blocks_on_domain" ON "domain_blocks" ("domain");
-- fasp_providers definição
CREATE TABLE "fasp_providers" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "confirmed" boolean DEFAULT 0 NOT NULL, "name" varchar NOT NULL, "base_url" varchar NOT NULL, "sign_in_url" varchar, "remote_identifier" varchar NOT NULL, "provider_public_key_pem" varchar NOT NULL, "server_private_key_pem" varchar NOT NULL, "capabilities" json DEFAULT '[]' NOT NULL, "privacy_policy" json, "contact_email" varchar, "fediverse_account" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL);
CREATE UNIQUE INDEX "index_fasp_providers_on_base_url" ON "fasp_providers" ("base_url");
-- ip_blocks definição
CREATE TABLE "ip_blocks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "ip" varchar DEFAULT '0.0.0.0' NOT NULL, "severity" integer DEFAULT 0 NOT NULL, "expires_at" datetime, "comment" text DEFAULT '' NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL);
CREATE UNIQUE INDEX "index_ip_blocks_on_ip" ON "ip_blocks" ("ip");
-- pghero_space_stats definição
CREATE TABLE "pghero_space_stats" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "database" text, "schema" text, "relation" text, "size" bigint, "captured_at" datetime);
CREATE INDEX "index_pghero_space_stats_on_database_and_captured_at" ON "pghero_space_stats" ("database", "captured_at");
-- preview_cards_statuses definição
CREATE TABLE "preview_cards_statuses" ("preview_card_id" bigint NOT NULL, "status_id" bigint NOT NULL, "url" varchar, PRIMARY KEY ("status_id", "preview_card_id"));
-- preview_card_providers definição
CREATE TABLE "preview_card_providers" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "domain" varchar DEFAULT '' NOT NULL, "icon_file_name" varchar, "icon_content_type" varchar, "icon_file_size" bigint, "icon_updated_at" datetime, "trendable" boolean, "reviewed_at" datetime, "requested_review_at" datetime, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL);
CREATE UNIQUE INDEX "index_preview_card_providers_on_domain" ON "preview_card_providers" ("domain");
-- relationship_severance_events definição
CREATE TABLE "relationship_severance_events" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "type" integer NOT NULL, "target_name" varchar NOT NULL, "purged" boolean DEFAULT 0 NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL);
CREATE INDEX "index_relationship_severance_events_on_type_and_target_name" ON "relationship_severance_events" ("type", "target_name");
-- relays definição
CREATE TABLE "relays" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "inbox_url" varchar DEFAULT '' NOT NULL, "follow_activity_id" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "state" integer DEFAULT 0 NOT NULL);
-- rules definição
CREATE TABLE "rules" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "priority" integer DEFAULT 0 NOT NULL, "deleted_at" datetime, "text" text DEFAULT '' NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "hint" text DEFAULT '' NOT NULL);
-- schema_migrations definição
CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY);
-- settings definição
CREATE TABLE "settings" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "var" varchar NOT NULL, "value" text, "created_at" datetime, "updated_at" datetime);
CREATE UNIQUE INDEX "index_settings_on_var" ON "settings" ("var");
-- site_uploads definição
CREATE TABLE "site_uploads" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "var" varchar DEFAULT '' NOT NULL, "file_file_name" varchar, "file_content_type" varchar, "file_file_size" integer, "file_updated_at" datetime, "meta" json, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "blurhash" varchar);
CREATE UNIQUE INDEX "index_site_uploads_on_var" ON "site_uploads" ("var");
-- software_updates definição
CREATE TABLE "software_updates" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "version" varchar NOT NULL, "urgent" boolean DEFAULT 0 NOT NULL, "type" integer DEFAULT 0 NOT NULL, "release_notes" varchar DEFAULT '' NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL);
CREATE UNIQUE INDEX "index_software_updates_on_version" ON "software_updates" ("version");
-- tags definição
CREATE TABLE "tags" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar DEFAULT '' NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "usable" boolean, "trendable" boolean, "listable" boolean, "reviewed_at" datetime, "requested_review_at" datetime, "last_status_at" datetime, "max_score" float, "max_score_at" datetime, "display_name" varchar);
CREATE UNIQUE INDEX "index_tags_on_name_lower_btree" ON "tags" ("name");
-- terms_of_services definição
CREATE TABLE "terms_of_services" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "text" text DEFAULT '' NOT NULL, "changelog" text DEFAULT '' NOT NULL, "published_at" datetime(6), "notification_sent_at" datetime(6), "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, "effective_date" date);
CREATE UNIQUE INDEX "index_terms_of_services_on_effective_date" ON "terms_of_services" ("effective_date") WHERE (effective_date IS NOT NULL);
-- unavailable_domains definição
CREATE TABLE "unavailable_domains" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "domain" varchar DEFAULT '' NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL);
CREATE UNIQUE INDEX "index_unavailable_domains_on_domain" ON "unavailable_domains" ("domain");
-- user_roles definição
CREATE TABLE "user_roles" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar DEFAULT '' NOT NULL, "color" varchar DEFAULT '' NOT NULL, "position" integer DEFAULT 0 NOT NULL, "permissions" bigint DEFAULT 0 NOT NULL, "highlighted" boolean DEFAULT 0 NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL);
-- webhooks definição
CREATE TABLE "webhooks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "url" varchar NOT NULL, "events" varchar DEFAULT '[]' NOT NULL, "secret" varchar DEFAULT '' NOT NULL, "enabled" boolean DEFAULT 1 NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, "template" text);
CREATE UNIQUE INDEX "index_webhooks_on_url" ON "webhooks" ("url");
-- accounts definição
CREATE TABLE "accounts" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "username" varchar DEFAULT '' NOT NULL, "domain" varchar, "private_key" text, "public_key" text DEFAULT '' NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, "note" text DEFAULT '' NOT NULL, "display_name" varchar DEFAULT '' NOT NULL, "uri" varchar DEFAULT '' NOT NULL, "url" varchar, "avatar_file_name" varchar, "avatar_content_type" varchar, "avatar_file_size" integer, "avatar_updated_at" datetime(6), "header_file_name" varchar, "header_content_type" varchar, "header_file_size" integer, "header_updated_at" datetime(6), "avatar_remote_url" varchar, "locked" boolean DEFAULT 0 NOT NULL, "header_remote_url" varchar DEFAULT '' NOT NULL, "last_webfingered_at" datetime(6), "inbox_url" varchar DEFAULT '' NOT NULL, "outbox_url" varchar DEFAULT '' NOT NULL, "shared_inbox_url" varchar DEFAULT '' NOT NULL, "followers_url" varchar DEFAULT '' NOT NULL, "protocol" integer DEFAULT 0 NOT NULL, "memorial" boolean DEFAULT 0 NOT NULL, "moved_to_account_id" integer, "featured_collection_url" varchar, "fields" text, "actor_type" varchar, "discoverable" boolean, "also_known_as" varchar DEFAULT '[]', "silenced_at" datetime(6), "suspended_at" datetime(6), "hide_collections" boolean, "avatar_storage_schema_version" integer, "header_storage_schema_version" integer, "sensitized_at" datetime(6), "suspension_origin" integer, "trendable" boolean, "reviewed_at" datetime(6), "requested_review_at" datetime(6), "indexable" boolean DEFAULT 0 NOT NULL, "attribution_domains" varchar DEFAULT '[]', CONSTRAINT "fk_rails_2320833084"
FOREIGN KEY ("moved_to_account_id")
REFERENCES "accounts" ("id")
ON DELETE SET NULL);
CREATE INDEX "index_accounts_on_domain_and_id" ON "accounts" ("domain", "id");
CREATE INDEX "index_accounts_on_moved_to_account_id" ON "accounts" ("moved_to_account_id");
CREATE INDEX "index_accounts_on_uri" ON "accounts" ("uri");
CREATE INDEX "index_accounts_on_url" ON "accounts" ("url");
-- account_aliases definição
CREATE TABLE "account_aliases" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "acct" varchar DEFAULT '' NOT NULL, "uri" varchar DEFAULT '' NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, CONSTRAINT "fk_rails_fc91575d08"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_account_aliases_on_account_id_and_uri" ON "account_aliases" ("account_id", "uri");
-- account_conversations definição
CREATE TABLE "account_conversations" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "conversation_id" bigint NOT NULL, "participant_account_ids" bigint NOT NULL, "status_ids" bigint NOT NULL, "last_status_id" bigint, "lock_version" integer DEFAULT 0 NOT NULL, "unread" boolean DEFAULT 0 NOT NULL, CONSTRAINT "fk_rails_6f5278b6e9"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_1491654f9f"
FOREIGN KEY ("conversation_id")
REFERENCES "conversations" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_unique_conversations" ON "account_conversations" ("account_id", "conversation_id", "participant_account_ids");
CREATE INDEX "index_account_conversations_on_conversation_id" ON "account_conversations" ("conversation_id");
-- account_deletion_requests definição
CREATE TABLE "account_deletion_requests" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, CONSTRAINT "fk_rails_45bf2626b9"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_account_deletion_requests_on_account_id" ON "account_deletion_requests" ("account_id");
-- account_domain_blocks definição
CREATE TABLE "account_domain_blocks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "domain" varchar NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "account_id" bigint NOT NULL, CONSTRAINT "fk_206c6029bd"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_account_domain_blocks_on_account_id_and_domain" ON "account_domain_blocks" ("account_id", "domain");
-- account_migrations definição
CREATE TABLE "account_migrations" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint, "acct" varchar DEFAULT '' NOT NULL, "followers_count" bigint DEFAULT 0 NOT NULL, "target_account_id" bigint, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, CONSTRAINT "fk_rails_d9a8dad070"
FOREIGN KEY ("target_account_id")
REFERENCES "accounts" ("id")
ON DELETE SET NULL, CONSTRAINT "fk_rails_c9f701caaf"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_account_migrations_on_account_id" ON "account_migrations" ("account_id");
CREATE INDEX "index_account_migrations_on_target_account_id" ON "account_migrations" ("target_account_id") WHERE (target_account_id IS NOT NULL);
-- account_moderation_notes definição
CREATE TABLE "account_moderation_notes" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "content" text NOT NULL, "account_id" bigint NOT NULL, "target_account_id" bigint NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, CONSTRAINT "fk_rails_dd62ed5ac3"
FOREIGN KEY ("target_account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_3f8b75089b"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_account_moderation_notes_on_account_id" ON "account_moderation_notes" ("account_id");
CREATE INDEX "index_account_moderation_notes_on_target_account_id" ON "account_moderation_notes" ("target_account_id");
-- account_notes definição
CREATE TABLE "account_notes" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "target_account_id" bigint NOT NULL, "comment" text NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, CONSTRAINT "fk_rails_2801b48f1a"
FOREIGN KEY ("target_account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_4ee4503c69"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_account_notes_on_account_id_and_target_account_id" ON "account_notes" ("account_id", "target_account_id");
CREATE INDEX "index_account_notes_on_target_account_id" ON "account_notes" ("target_account_id");
-- account_pins definição
CREATE TABLE "account_pins" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "target_account_id" bigint NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, CONSTRAINT "fk_rails_a176e26c37"
FOREIGN KEY ("target_account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_d44979e5dd"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_account_pins_on_account_id_and_target_account_id" ON "account_pins" ("account_id", "target_account_id");
CREATE INDEX "index_account_pins_on_target_account_id" ON "account_pins" ("target_account_id");
-- account_relationship_severance_events definição
CREATE TABLE "account_relationship_severance_events" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "relationship_severance_event_id" bigint NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, "followers_count" integer DEFAULT 0 NOT NULL, "following_count" integer DEFAULT 0 NOT NULL, CONSTRAINT "fk_rails_030c916965"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_8a34c3a361"
FOREIGN KEY ("relationship_severance_event_id")
REFERENCES "relationship_severance_events" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "idx_on_account_id_relationship_severance_event_id_7bd82bf20e" ON "account_relationship_severance_events" ("account_id", "relationship_severance_event_id");
CREATE INDEX "idx_on_relationship_severance_event_id_403f53e707" ON "account_relationship_severance_events" ("relationship_severance_event_id");
-- account_stats definição
CREATE TABLE "account_stats" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "statuses_count" bigint DEFAULT 0 NOT NULL, "following_count" bigint DEFAULT 0 NOT NULL, "followers_count" bigint DEFAULT 0 NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "last_status_at" datetime, CONSTRAINT "fk_rails_215bb31ff1"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_account_stats_on_account_id" ON "account_stats" ("account_id");
CREATE INDEX "index_account_stats_on_last_status_at_and_account_id" ON "account_stats" ("last_status_at", "account_id");
-- account_statuses_cleanup_policies definição
CREATE TABLE "account_statuses_cleanup_policies" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "enabled" boolean DEFAULT 1 NOT NULL, "min_status_age" integer DEFAULT 1209600 NOT NULL, "keep_direct" boolean DEFAULT 1 NOT NULL, "keep_pinned" boolean DEFAULT 1 NOT NULL, "keep_polls" boolean DEFAULT 0 NOT NULL, "keep_media" boolean DEFAULT 0 NOT NULL, "keep_self_fav" boolean DEFAULT 1 NOT NULL, "keep_self_bookmark" boolean DEFAULT 1 NOT NULL, "min_favs" integer, "min_reblogs" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_23d5f73cfe"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_account_statuses_cleanup_policies_on_account_id" ON "account_statuses_cleanup_policies" ("account_id");
-- admin_action_logs definição
CREATE TABLE "admin_action_logs" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "action" varchar DEFAULT '' NOT NULL, "target_type" varchar, "target_id" bigint, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "human_identifier" varchar, "route_param" varchar, "permalink" varchar, CONSTRAINT "fk_rails_a7667297fa"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_admin_action_logs_on_account_id" ON "admin_action_logs" ("account_id");
CREATE INDEX "index_admin_action_logs_on_target_type_and_target_id" ON "admin_action_logs" ("target_type", "target_id");
-- announcement_mutes definição
CREATE TABLE "announcement_mutes" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "announcement_id" bigint NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, CONSTRAINT "fk_rails_9c99f8e835"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_e35401adf1"
FOREIGN KEY ("announcement_id")
REFERENCES "announcements" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_announcement_mutes_on_account_id_and_announcement_id" ON "announcement_mutes" ("account_id", "announcement_id");
CREATE INDEX "index_announcement_mutes_on_announcement_id" ON "announcement_mutes" ("announcement_id");
-- announcement_reactions definição
CREATE TABLE "announcement_reactions" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "announcement_id" bigint NOT NULL, "name" varchar DEFAULT '' NOT NULL, "custom_emoji_id" bigint, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, CONSTRAINT "fk_rails_a1226eaa5c"
FOREIGN KEY ("announcement_id")
REFERENCES "announcements" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_7444ad831f"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_b742c91c0e"
FOREIGN KEY ("custom_emoji_id")
REFERENCES "custom_emojis" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_announcement_reactions_on_account_id_and_announcement_id" ON "announcement_reactions" ("account_id", "announcement_id", "name");
CREATE INDEX "index_announcement_reactions_on_announcement_id" ON "announcement_reactions" ("announcement_id");
CREATE INDEX "index_announcement_reactions_on_custom_emoji_id" ON "announcement_reactions" ("custom_emoji_id") WHERE (custom_emoji_id IS NOT NULL);
-- blocks definição
CREATE TABLE "blocks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "account_id" bigint NOT NULL, "target_account_id" bigint NOT NULL, "uri" varchar, CONSTRAINT "fk_rails_009e331529"
FOREIGN KEY ("target_account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_4269e03e65"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_blocks_on_account_id_and_target_account_id" ON "blocks" ("account_id", "target_account_id");
CREATE INDEX "index_blocks_on_target_account_id" ON "blocks" ("target_account_id");
-- bulk_imports definição
CREATE TABLE "bulk_imports" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "type" integer NOT NULL, "state" integer NOT NULL, "total_items" integer DEFAULT 0 NOT NULL, "imported_items" integer DEFAULT 0 NOT NULL, "processed_items" integer DEFAULT 0 NOT NULL, "finished_at" datetime, "overwrite" boolean DEFAULT 0 NOT NULL, "likely_mismatched" boolean DEFAULT 0 NOT NULL, "original_filename" varchar DEFAULT '' NOT NULL, "account_id" bigint NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_1d89c0f8b2"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_bulk_imports_on_account_id" ON "bulk_imports" ("account_id");
CREATE INDEX "index_bulk_imports_unconfirmed" ON "bulk_imports" ("id") WHERE (state = 0);
-- bulk_import_rows definição
CREATE TABLE "bulk_import_rows" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "bulk_import_id" bigint NOT NULL, "data" json, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_d39af34335"
FOREIGN KEY ("bulk_import_id")
REFERENCES "bulk_imports" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_bulk_import_rows_on_bulk_import_id" ON "bulk_import_rows" ("bulk_import_id");
-- canonical_email_blocks definição
CREATE TABLE "canonical_email_blocks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "canonical_email_hash" varchar DEFAULT '' NOT NULL, "reference_account_id" bigint, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_1ecb262096"
FOREIGN KEY ("reference_account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_canonical_email_blocks_on_canonical_email_hash" ON "canonical_email_blocks" ("canonical_email_hash");
CREATE INDEX "index_canonical_email_blocks_on_reference_account_id" ON "canonical_email_blocks" ("reference_account_id");
-- conversation_mutes definição
CREATE TABLE "conversation_mutes" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "conversation_id" bigint NOT NULL, "account_id" bigint NOT NULL, CONSTRAINT "fk_rails_69510c1b77"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_5ab139311f"
FOREIGN KEY ("conversation_id")
REFERENCES "conversations" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_conversation_mutes_on_account_id_and_conversation_id" ON "conversation_mutes" ("account_id", "conversation_id");
-- custom_filters definição
CREATE TABLE "custom_filters" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "expires_at" datetime, "phrase" text DEFAULT '' NOT NULL, "context" varchar DEFAULT '[]' NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "action" integer DEFAULT 0 NOT NULL, CONSTRAINT "fk_rails_8b8d786993"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_custom_filters_on_account_id" ON "custom_filters" ("account_id");
-- custom_filter_keywords definição
CREATE TABLE "custom_filter_keywords" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "custom_filter_id" bigint NOT NULL, "keyword" text DEFAULT '' NOT NULL, "whole_word" boolean DEFAULT 1 NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_5a49a74012"
FOREIGN KEY ("custom_filter_id")
REFERENCES "custom_filters" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_custom_filter_keywords_on_custom_filter_id" ON "custom_filter_keywords" ("custom_filter_id");
-- email_domain_blocks definição
CREATE TABLE "email_domain_blocks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "domain" varchar DEFAULT '' NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "parent_id" bigint, "allow_with_approval" boolean DEFAULT 0 NOT NULL, CONSTRAINT "fk_rails_408efe0a15"
FOREIGN KEY ("parent_id")
REFERENCES "email_domain_blocks" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_email_domain_blocks_on_domain" ON "email_domain_blocks" ("domain");
-- fasp_debug_callbacks definição
CREATE TABLE "fasp_debug_callbacks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "fasp_provider_id" bigint NOT NULL, "ip" varchar NOT NULL, "request_body" text NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_c1650087cd"
FOREIGN KEY ("fasp_provider_id")
REFERENCES "fasp_providers" ("id")
);
CREATE INDEX "index_fasp_debug_callbacks_on_fasp_provider_id" ON "fasp_debug_callbacks" ("fasp_provider_id");
-- featured_tags definição
CREATE TABLE "featured_tags" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "tag_id" bigint NOT NULL, "statuses_count" bigint DEFAULT 0 NOT NULL, "last_status_at" datetime, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "name" varchar, CONSTRAINT "fk_rails_174efcf15f"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_23a9055c7c"
FOREIGN KEY ("tag_id")
REFERENCES "tags" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_featured_tags_on_account_id_and_tag_id" ON "featured_tags" ("account_id", "tag_id");
CREATE INDEX "index_featured_tags_on_tag_id" ON "featured_tags" ("tag_id");
-- follows definição
CREATE TABLE "follows" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "account_id" bigint NOT NULL, "target_account_id" bigint NOT NULL, "show_reblogs" boolean DEFAULT 1 NOT NULL, "uri" varchar, "notify" boolean DEFAULT 0 NOT NULL, "languages" varchar DEFAULT '[]', CONSTRAINT "fk_rails_ac4936d17b"
FOREIGN KEY ("target_account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_32ed1b5560"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_follows_on_account_id_and_target_account_id" ON "follows" ("account_id", "target_account_id");
CREATE INDEX "index_follows_on_target_account_id" ON "follows" ("target_account_id");
-- follow_recommendation_mutes definição
CREATE TABLE "follow_recommendation_mutes" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "target_account_id" bigint NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_a9f09ec9a8"
FOREIGN KEY ("target_account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_d36abd69ea"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "idx_on_account_id_target_account_id_a8c8ddf44e" ON "follow_recommendation_mutes" ("account_id", "target_account_id");
CREATE INDEX "index_follow_recommendation_mutes_on_target_account_id" ON "follow_recommendation_mutes" ("target_account_id");
-- follow_recommendation_suppressions definição
CREATE TABLE "follow_recommendation_suppressions" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_dfb9a1dbe2"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_follow_recommendation_suppressions_on_account_id" ON "follow_recommendation_suppressions" ("account_id");
-- follow_requests definição
CREATE TABLE "follow_requests" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "account_id" bigint NOT NULL, "target_account_id" bigint NOT NULL, "show_reblogs" boolean DEFAULT 1 NOT NULL, "uri" varchar, "notify" boolean DEFAULT 0 NOT NULL, "languages" varchar DEFAULT '[]', CONSTRAINT "fk_rails_972b9f1173"
FOREIGN KEY ("target_account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_76d644b0e7"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_follow_requests_on_account_id_and_target_account_id" ON "follow_requests" ("account_id", "target_account_id");
-- generated_annual_reports definição
CREATE TABLE "generated_annual_reports" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "year" integer NOT NULL, "data" json NOT NULL, "schema_version" integer NOT NULL, "viewed_at" datetime(6), "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_4ca37f035c"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
);
CREATE UNIQUE INDEX "index_generated_annual_reports_on_account_id_and_year" ON "generated_annual_reports" ("account_id", "year");
-- lists definição
CREATE TABLE "lists" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "title" varchar DEFAULT '' NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "replies_policy" integer DEFAULT 0 NOT NULL, "exclusive" boolean DEFAULT 0 NOT NULL, CONSTRAINT "fk_rails_3853b78dac"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_lists_on_account_id" ON "lists" ("account_id");
-- list_accounts definição
CREATE TABLE "list_accounts" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "list_id" bigint NOT NULL, "account_id" bigint NOT NULL, "follow_id" bigint, "follow_request_id" bigint, CONSTRAINT "fk_rails_40f9cc29f1"
FOREIGN KEY ("follow_id")
REFERENCES "follows" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_85fee9d6ab"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_f11f9d1fcc"
FOREIGN KEY ("follow_request_id")
REFERENCES "follow_requests" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_e54e356c88"
FOREIGN KEY ("list_id")
REFERENCES "lists" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_list_accounts_on_account_id_and_list_id" ON "list_accounts" ("account_id", "list_id");
CREATE INDEX "index_list_accounts_on_follow_id" ON "list_accounts" ("follow_id") WHERE (follow_id IS NOT NULL);
CREATE INDEX "index_list_accounts_on_follow_request_id" ON "list_accounts" ("follow_request_id") WHERE (follow_request_id IS NOT NULL);
CREATE INDEX "index_list_accounts_on_list_id_and_account_id" ON "list_accounts" ("list_id", "account_id");
-- mutes definição
CREATE TABLE "mutes" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "hide_notifications" boolean DEFAULT 1 NOT NULL, "account_id" bigint NOT NULL, "target_account_id" bigint NOT NULL, "expires_at" datetime, CONSTRAINT "fk_rails_802b245a68"
FOREIGN KEY ("target_account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_b8d8daf315"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_mutes_on_account_id_and_target_account_id" ON "mutes" ("account_id", "target_account_id");
CREATE INDEX "index_mutes_on_target_account_id" ON "mutes" ("target_account_id");
-- notifications definição
CREATE TABLE "notifications" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "activity_id" bigint NOT NULL, "activity_type" varchar NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "account_id" bigint NOT NULL, "from_account_id" bigint NOT NULL, "type" varchar, "filtered" boolean DEFAULT 0 NOT NULL, "group_key" varchar, CONSTRAINT "fk_rails_a9df2835a1"
FOREIGN KEY ("from_account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_c141c8ee55"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_notifications_on_account_id_and_group_key" ON "notifications" ("account_id", "group_key") WHERE (group_key IS NOT NULL);
CREATE INDEX "index_notifications_on_account_id_and_id_and_type" ON "notifications" ("account_id", "id" DESC, "type");
CREATE INDEX "index_notifications_on_filtered" ON "notifications" ("account_id", "id" DESC, "type") WHERE (filtered = false);
CREATE INDEX "index_notifications_on_activity_id_and_activity_type" ON "notifications" ("activity_id", "activity_type");
CREATE INDEX "index_notifications_on_from_account_id" ON "notifications" ("from_account_id");
-- notification_permissions definição
CREATE TABLE "notification_permissions" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "from_account_id" bigint NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_e3e0aaad70"
FOREIGN KEY ("from_account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_7c0bed08df"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_notification_permissions_on_account_id" ON "notification_permissions" ("account_id");
CREATE INDEX "index_notification_permissions_on_from_account_id" ON "notification_permissions" ("from_account_id");
-- notification_policies definição
CREATE TABLE "notification_policies" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, "for_not_following" integer DEFAULT 0 NOT NULL, "for_not_followers" integer DEFAULT 0 NOT NULL, "for_new_accounts" integer DEFAULT 0 NOT NULL, "for_private_mentions" integer DEFAULT 1 NOT NULL, "for_limited_accounts" integer DEFAULT 1 NOT NULL, CONSTRAINT "fk_rails_506d62f0da"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_notification_policies_on_account_id" ON "notification_policies" ("account_id");
-- preview_cards definição
CREATE TABLE "preview_cards" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "url" varchar DEFAULT '' NOT NULL, "title" varchar DEFAULT '' NOT NULL, "description" varchar DEFAULT '' NOT NULL, "image_file_name" varchar, "image_content_type" varchar, "image_file_size" integer, "image_updated_at" datetime, "type" integer DEFAULT 0 NOT NULL, "html" text DEFAULT '' NOT NULL, "author_name" varchar DEFAULT '' NOT NULL, "author_url" varchar DEFAULT '' NOT NULL, "provider_name" varchar DEFAULT '' NOT NULL, "provider_url" varchar DEFAULT '' NOT NULL, "width" integer DEFAULT 0 NOT NULL, "height" integer DEFAULT 0 NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "embed_url" varchar DEFAULT '' NOT NULL, "image_storage_schema_version" integer, "blurhash" varchar, "language" varchar, "max_score" float, "max_score_at" datetime, "trendable" boolean, "link_type" integer, "published_at" datetime(6), "image_description" varchar DEFAULT '' NOT NULL, "author_account_id" bigint, CONSTRAINT "fk_rails_dca4905b94"
FOREIGN KEY ("author_account_id")
REFERENCES "accounts" ("id")
ON DELETE SET NULL);
CREATE INDEX "index_preview_cards_on_author_account_id" ON "preview_cards" ("author_account_id") WHERE (author_account_id IS NOT NULL);
CREATE UNIQUE INDEX "index_preview_cards_on_url" ON "preview_cards" ("url");
-- preview_card_trends definição
CREATE TABLE "preview_card_trends" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "preview_card_id" bigint NOT NULL, "score" float DEFAULT 0.0 NOT NULL, "rank" integer DEFAULT 0 NOT NULL, "allowed" boolean DEFAULT 0 NOT NULL, "language" varchar, CONSTRAINT "fk_rails_371593db34"
FOREIGN KEY ("preview_card_id")
REFERENCES "preview_cards" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_preview_card_trends_on_preview_card_id" ON "preview_card_trends" ("preview_card_id");
-- scheduled_statuses definição
CREATE TABLE "scheduled_statuses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "scheduled_at" datetime, "params" json, CONSTRAINT "fk_rails_23bd9018f9"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_scheduled_statuses_on_account_id" ON "scheduled_statuses" ("account_id");
CREATE INDEX "index_scheduled_statuses_on_scheduled_at" ON "scheduled_statuses" ("scheduled_at");
-- severed_relationships definição
CREATE TABLE "severed_relationships" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "relationship_severance_event_id" bigint NOT NULL, "local_account_id" bigint NOT NULL, "remote_account_id" bigint NOT NULL, "direction" integer NOT NULL, "show_reblogs" boolean, "notify" boolean, "languages" varchar DEFAULT '[]', "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_f7afd97ba4"
FOREIGN KEY ("remote_account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_98ff099d4c"
FOREIGN KEY ("local_account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_5054494e1e"
FOREIGN KEY ("relationship_severance_event_id")
REFERENCES "relationship_severance_events" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_severed_relationships_on_local_account_and_event" ON "severed_relationships" ("local_account_id", "relationship_severance_event_id");
CREATE UNIQUE INDEX "index_severed_relationships_on_unique_tuples" ON "severed_relationships" ("relationship_severance_event_id", "local_account_id", "direction", "remote_account_id");
CREATE INDEX "index_severed_relationships_on_remote_account_id" ON "severed_relationships" ("remote_account_id");
-- statuses definição
CREATE TABLE "statuses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "uri" varchar, "text" text DEFAULT '' NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, "in_reply_to_id" bigint, "reblog_of_id" bigint, "url" varchar, "sensitive" boolean DEFAULT 0 NOT NULL, "visibility" integer DEFAULT 0 NOT NULL, "spoiler_text" text DEFAULT '' NOT NULL, "reply" boolean DEFAULT 0 NOT NULL, "language" varchar, "conversation_id" bigint, "local" boolean, "account_id" bigint NOT NULL, "application_id" bigint, "in_reply_to_account_id" bigint, "poll_id" bigint, "deleted_at" datetime(6), "edited_at" datetime(6), "trendable" boolean, "ordered_media_attachment_ids" text DEFAULT '[]', "fetched_replies_at" datetime(6), "quote_approval_policy" integer DEFAULT 0 NOT NULL, CONSTRAINT "fk_rails_94a6f70399"
FOREIGN KEY ("in_reply_to_id")
REFERENCES "statuses" ("id")
ON DELETE SET NULL, CONSTRAINT "fk_rails_5904f5f441"
FOREIGN KEY ("in_reply_to_account_id")
REFERENCES "accounts" ("id")
ON DELETE SET NULL, CONSTRAINT "fk_rails_1a7bc3aca9"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_256483a9ab"
FOREIGN KEY ("reblog_of_id")
REFERENCES "statuses" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_statuses_20190820" ON "statuses" ("account_id", "id", "visibility", "updated_at");
CREATE INDEX "index_statuses_on_account_id" ON "statuses" ("account_id");
CREATE INDEX "index_statuses_on_deleted_at" ON "statuses" ("deleted_at");
CREATE INDEX "index_statuses_local_20190824" ON "statuses" ("id", "account_id");
CREATE INDEX "index_statuses_public_20250129" ON "statuses" ("id", "language", "account_id");
CREATE INDEX "index_statuses_on_in_reply_to_account_id" ON "statuses" ("in_reply_to_account_id");
CREATE INDEX "index_statuses_on_in_reply_to_id" ON "statuses" ("in_reply_to_id");
CREATE INDEX "index_statuses_on_reblog_of_id_and_account_id" ON "statuses" ("reblog_of_id", "account_id");
CREATE UNIQUE INDEX "index_statuses_on_uri" ON "statuses" ("uri");
-- statuses_tags definição
CREATE TABLE "statuses_tags" ("status_id" bigint NOT NULL, "tag_id" bigint NOT NULL, PRIMARY KEY ("tag_id", "status_id"), CONSTRAINT "fk_rails_df0fe11427"
FOREIGN KEY ("status_id")
REFERENCES "statuses" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_3081861e21"
FOREIGN KEY ("tag_id")
REFERENCES "tags" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_statuses_tags_on_status_id" ON "statuses_tags" ("status_id");
-- status_edits definição
CREATE TABLE "status_edits" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "status_id" bigint NOT NULL, "account_id" bigint, "text" text DEFAULT '' NOT NULL, "spoiler_text" text DEFAULT '' NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, "ordered_media_attachment_ids" bigint, "media_descriptions" text DEFAULT '[]', "poll_options" varchar DEFAULT '[]', "sensitive" boolean, "quote_id" bigint, CONSTRAINT "fk_rails_dc8988c545"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE SET NULL, CONSTRAINT "fk_rails_a960f234a0"
FOREIGN KEY ("status_id")
REFERENCES "statuses" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_status_edits_on_account_id" ON "status_edits" ("account_id");
CREATE INDEX "index_status_edits_on_status_id" ON "status_edits" ("status_id");
-- status_pins definição
CREATE TABLE "status_pins" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "status_id" bigint NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, CONSTRAINT "fk_rails_c3470a9de3"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_65c05552f1"
FOREIGN KEY ("status_id")
REFERENCES "statuses" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_status_pins_on_account_id_and_status_id" ON "status_pins" ("account_id", "status_id");
CREATE INDEX "index_status_pins_on_status_id" ON "status_pins" ("status_id");
-- status_stats definição
CREATE TABLE "status_stats" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "status_id" bigint NOT NULL, "replies_count" bigint DEFAULT 0 NOT NULL, "reblogs_count" bigint DEFAULT 0 NOT NULL, "favourites_count" bigint DEFAULT 0 NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "untrusted_favourites_count" bigint, "untrusted_reblogs_count" bigint, CONSTRAINT "fk_rails_4a247aac42"
FOREIGN KEY ("status_id")
REFERENCES "statuses" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_status_stats_on_status_id" ON "status_stats" ("status_id");
-- status_trends definição
CREATE TABLE "status_trends" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "status_id" bigint NOT NULL, "account_id" bigint NOT NULL, "score" float DEFAULT 0.0 NOT NULL, "rank" integer DEFAULT 0 NOT NULL, "allowed" boolean DEFAULT 0 NOT NULL, "language" varchar, CONSTRAINT "fk_rails_a6b527ea49"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_68c610dc1a"
FOREIGN KEY ("status_id")
REFERENCES "statuses" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_status_trends_on_account_id" ON "status_trends" ("account_id");
CREATE UNIQUE INDEX "index_status_trends_on_status_id" ON "status_trends" ("status_id");
-- tag_follows definição
CREATE TABLE "tag_follows" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "tag_id" bigint NOT NULL, "account_id" bigint NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_091e831473"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_0deefe597f"
FOREIGN KEY ("tag_id")
REFERENCES "tags" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_tag_follows_on_account_id_and_tag_id" ON "tag_follows" ("account_id", "tag_id");
CREATE INDEX "index_tag_follows_on_tag_id" ON "tag_follows" ("tag_id");
-- tag_trends definição
CREATE TABLE "tag_trends" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "tag_id" bigint NOT NULL, "score" float DEFAULT 0.0 NOT NULL, "rank" integer DEFAULT 0 NOT NULL, "allowed" boolean DEFAULT 0 NOT NULL, "language" varchar DEFAULT '' NOT NULL, CONSTRAINT "fk_rails_3033046460"
FOREIGN KEY ("tag_id")
REFERENCES "tags" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_tag_trends_on_tag_id_and_language" ON "tag_trends" ("tag_id", "language");
-- tombstones definição
CREATE TABLE "tombstones" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "uri" varchar NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "by_moderator" boolean, CONSTRAINT "fk_rails_f95b861449"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_tombstones_on_account_id" ON "tombstones" ("account_id");
CREATE INDEX "index_tombstones_on_uri" ON "tombstones" ("uri");
-- bookmarks definição
CREATE TABLE "bookmarks" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "status_id" bigint NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, CONSTRAINT "fk_rails_9f6ac182a6"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_11207ffcfd"
FOREIGN KEY ("status_id")
REFERENCES "statuses" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_bookmarks_on_account_id_and_status_id" ON "bookmarks" ("account_id", "status_id");
CREATE INDEX "index_bookmarks_on_status_id" ON "bookmarks" ("status_id");
-- custom_filter_statuses definição
CREATE TABLE "custom_filter_statuses" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "custom_filter_id" bigint NOT NULL, "status_id" bigint NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_e2ddaf5b14"
FOREIGN KEY ("custom_filter_id")
REFERENCES "custom_filters" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_2f6d20c0cf"
FOREIGN KEY ("status_id")
REFERENCES "statuses" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_custom_filter_statuses_on_custom_filter_id" ON "custom_filter_statuses" ("custom_filter_id");
CREATE UNIQUE INDEX "index_custom_filter_statuses_on_status_id_and_custom_filter_id" ON "custom_filter_statuses" ("status_id", "custom_filter_id");
-- favourites definição
CREATE TABLE "favourites" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "account_id" bigint NOT NULL, "status_id" bigint NOT NULL, CONSTRAINT "fk_rails_0763833708"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_b0e856845e"
FOREIGN KEY ("status_id")
REFERENCES "statuses" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_favourites_on_account_id_and_id" ON "favourites" ("account_id", "id");
CREATE UNIQUE INDEX "index_favourites_on_account_id_and_status_id" ON "favourites" ("account_id", "status_id");
CREATE INDEX "index_favourites_on_status_id" ON "favourites" ("status_id");
-- media_attachments definição
CREATE TABLE "media_attachments" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "status_id" bigint, "file_file_name" varchar, "file_content_type" varchar, "file_file_size" integer, "file_updated_at" datetime(6), "remote_url" varchar DEFAULT '' NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, "shortcode" varchar, "type" integer DEFAULT 0 NOT NULL, "file_meta" text, "account_id" bigint, "description" text, "scheduled_status_id" bigint, "blurhash" varchar, "processing" integer, "file_storage_schema_version" integer, "thumbnail_file_name" varchar, "thumbnail_content_type" varchar, "thumbnail_file_size" integer, "thumbnail_updated_at" datetime(6), "thumbnail_remote_url" varchar, CONSTRAINT "fk_rails_31fc5aeef1"
FOREIGN KEY ("scheduled_status_id")
REFERENCES "scheduled_statuses" ("id")
ON DELETE SET NULL, CONSTRAINT "fk_rails_2d19cca08b"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE SET NULL, CONSTRAINT "fk_rails_3ec0cfdd70"
FOREIGN KEY ("status_id")
REFERENCES "statuses" ("id")
ON DELETE SET NULL);
CREATE INDEX "index_media_attachments_on_account_id_and_status_id" ON "media_attachments" ("account_id", "status_id");
CREATE INDEX "index_media_attachments_on_scheduled_status_id" ON "media_attachments" ("scheduled_status_id");
CREATE UNIQUE INDEX "index_media_attachments_on_shortcode" ON "media_attachments" ("shortcode");
CREATE INDEX "index_media_attachments_on_status_id" ON "media_attachments" ("status_id");
-- mentions definição
CREATE TABLE "mentions" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "status_id" bigint NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "account_id" bigint NOT NULL, "silent" boolean DEFAULT 0 NOT NULL, CONSTRAINT "fk_rails_3130ff6a8f"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_59edbe2887"
FOREIGN KEY ("status_id")
REFERENCES "statuses" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_mentions_on_account_id_and_status_id" ON "mentions" ("account_id", "status_id");
CREATE INDEX "index_mentions_on_status_id" ON "mentions" ("status_id");
-- notification_requests definição
CREATE TABLE "notification_requests" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "from_account_id" bigint NOT NULL, "last_status_id" bigint, "notifications_count" bigint DEFAULT 0 NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_881c7f71c4"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_5632f121b4"
FOREIGN KEY ("from_account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_61c7aa9c1f"
FOREIGN KEY ("last_status_id")
REFERENCES "statuses" ("id")
ON DELETE SET NULL);
CREATE UNIQUE INDEX "index_notification_requests_on_account_id_and_from_account_id" ON "notification_requests" ("account_id", "from_account_id");
CREATE INDEX "index_notification_requests_on_from_account_id" ON "notification_requests" ("from_account_id");
CREATE INDEX "index_notification_requests_on_last_status_id" ON "notification_requests" ("last_status_id");
-- polls definição
CREATE TABLE "polls" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "status_id" bigint NOT NULL, "expires_at" datetime, "options" varchar DEFAULT '[]' NOT NULL, "cached_tallies" bigint NOT NULL, "multiple" boolean DEFAULT 0 NOT NULL, "hide_totals" boolean DEFAULT 0 NOT NULL, "votes_count" bigint DEFAULT 0 NOT NULL, "last_fetched_at" datetime, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "lock_version" integer DEFAULT 0 NOT NULL, "voters_count" bigint, CONSTRAINT "fk_rails_5b19a0c011"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_3e0d9f1115"
FOREIGN KEY ("status_id")
REFERENCES "statuses" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_polls_on_account_id" ON "polls" ("account_id");
CREATE INDEX "index_polls_on_status_id" ON "polls" ("status_id");
-- poll_votes definição
CREATE TABLE "poll_votes" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "poll_id" bigint NOT NULL, "choice" integer DEFAULT 0 NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "uri" varchar, CONSTRAINT "fk_rails_b6c18cf44a"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_a6e6974b7e"
FOREIGN KEY ("poll_id")
REFERENCES "polls" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_poll_votes_on_account_id" ON "poll_votes" ("account_id");
CREATE INDEX "index_poll_votes_on_poll_id" ON "poll_votes" ("poll_id");
-- quotes definição
CREATE TABLE "quotes" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "status_id" bigint NOT NULL, "quoted_status_id" bigint, "quoted_account_id" bigint, "state" integer DEFAULT 0 NOT NULL, "approval_uri" varchar, "activity_uri" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_38068caa0e"
FOREIGN KEY ("quoted_status_id")
REFERENCES "statuses" ("id")
ON DELETE SET NULL, CONSTRAINT "fk_rails_bfc5276b70"
FOREIGN KEY ("quoted_account_id")
REFERENCES "accounts" ("id")
ON DELETE SET NULL, CONSTRAINT "fk_rails_36d54169fc"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_bd3ab4462c"
FOREIGN KEY ("status_id")
REFERENCES "statuses" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_quotes_on_account_id_and_quoted_account_id" ON "quotes" ("account_id", "quoted_account_id");
CREATE UNIQUE INDEX "index_quotes_on_activity_uri" ON "quotes" ("activity_uri");
CREATE INDEX "index_quotes_on_approval_uri" ON "quotes" ("approval_uri");
CREATE INDEX "index_quotes_on_quoted_account_id" ON "quotes" ("quoted_account_id");
CREATE INDEX "index_quotes_on_quoted_status_id" ON "quotes" ("quoted_status_id");
CREATE UNIQUE INDEX "index_quotes_on_status_id" ON "quotes" ("status_id");
-- account_warnings definição
CREATE TABLE "account_warnings" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint, "target_account_id" bigint, "action" integer DEFAULT 0 NOT NULL, "text" text DEFAULT '' NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "report_id" bigint, "status_ids" varchar DEFAULT '[]', "overruled_at" datetime, CONSTRAINT "fk_rails_a65a1bf71b"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE SET NULL, CONSTRAINT "fk_rails_a7ebbb1e37"
FOREIGN KEY ("target_account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_8f2bab4b16"
FOREIGN KEY ("report_id")
REFERENCES "reports" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_account_warnings_on_account_id" ON "account_warnings" ("account_id");
CREATE INDEX "index_account_warnings_on_target_account_id" ON "account_warnings" ("target_account_id");
-- appeals definição
CREATE TABLE "appeals" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "account_id" bigint NOT NULL, "account_warning_id" bigint NOT NULL, "text" text DEFAULT '' NOT NULL, "approved_at" datetime, "approved_by_account_id" bigint, "rejected_at" datetime, "rejected_by_account_id" bigint, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_501c3a6e13"
FOREIGN KEY ("rejected_by_account_id")
REFERENCES "accounts" ("id")
ON DELETE SET NULL, CONSTRAINT "fk_rails_a99f14546e"
FOREIGN KEY ("account_warning_id")
REFERENCES "account_warnings" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_9deb2f63ad"
FOREIGN KEY ("approved_by_account_id")
REFERENCES "accounts" ("id")
ON DELETE SET NULL, CONSTRAINT "fk_rails_ea84881569"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_appeals_on_account_id" ON "appeals" ("account_id");
CREATE UNIQUE INDEX "index_appeals_on_account_warning_id" ON "appeals" ("account_warning_id");
CREATE INDEX "index_appeals_on_approved_by_account_id" ON "appeals" ("approved_by_account_id") WHERE (approved_by_account_id IS NOT NULL);
CREATE INDEX "index_appeals_on_rejected_by_account_id" ON "appeals" ("rejected_by_account_id") WHERE (rejected_by_account_id IS NOT NULL);
-- backups definição
CREATE TABLE "backups" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" bigint, "dump_file_name" varchar, "dump_content_type" varchar, "dump_updated_at" datetime, "processed" boolean DEFAULT 0 NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "dump_file_size" bigint, CONSTRAINT "fk_rails_096669d221"
FOREIGN KEY ("user_id")
REFERENCES "users" ("id")
ON DELETE SET NULL);
CREATE INDEX "index_backups_on_user_id" ON "backups" ("user_id");
-- identities definição
CREATE TABLE "identities" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "provider" varchar DEFAULT '' NOT NULL, "uid" varchar DEFAULT '' NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "user_id" bigint, CONSTRAINT "fk_bea040f377"
FOREIGN KEY ("user_id")
REFERENCES "users" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_identities_on_uid_and_provider" ON "identities" ("uid", "provider");
CREATE INDEX "index_identities_on_user_id" ON "identities" ("user_id");
-- invites definição
CREATE TABLE "invites" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" bigint NOT NULL, "code" varchar DEFAULT '' NOT NULL, "expires_at" datetime, "max_uses" integer, "uses" integer DEFAULT 0 NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "autofollow" boolean DEFAULT 0 NOT NULL, "comment" text, CONSTRAINT "fk_rails_ff69dbb2ac"
FOREIGN KEY ("user_id")
REFERENCES "users" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_invites_on_code" ON "invites" ("code");
CREATE INDEX "index_invites_on_user_id" ON "invites" ("user_id");
-- login_activities definição
CREATE TABLE "login_activities" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" bigint NOT NULL, "authentication_method" varchar, "provider" varchar, "success" boolean, "failure_reason" varchar, "ip" varchar, "user_agent" varchar, "created_at" datetime, CONSTRAINT "fk_rails_e4b6396b41"
FOREIGN KEY ("user_id")
REFERENCES "users" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_login_activities_on_user_id" ON "login_activities" ("user_id");
-- markers definição
CREATE TABLE "markers" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" bigint NOT NULL, "timeline" varchar DEFAULT '' NOT NULL, "last_read_id" bigint DEFAULT 0 NOT NULL, "lock_version" integer DEFAULT 0 NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, CONSTRAINT "fk_rails_a7009bc2b6"
FOREIGN KEY ("user_id")
REFERENCES "users" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_markers_on_user_id_and_timeline" ON "markers" ("user_id", "timeline");
-- oauth_access_grants definição
CREATE TABLE "oauth_access_grants" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "token" varchar NOT NULL, "expires_in" integer NOT NULL, "redirect_uri" text NOT NULL, "created_at" datetime NOT NULL, "revoked_at" datetime, "scopes" varchar, "application_id" bigint NOT NULL, "resource_owner_id" bigint NOT NULL, "code_challenge" varchar, "code_challenge_method" varchar, CONSTRAINT "fk_rails_b4b53e07b8"
FOREIGN KEY ("application_id")
REFERENCES "oauth_applications" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_63b044929b"
FOREIGN KEY ("resource_owner_id")
REFERENCES "users" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_oauth_access_grants_on_resource_owner_id" ON "oauth_access_grants" ("resource_owner_id");
CREATE UNIQUE INDEX "index_oauth_access_grants_on_token" ON "oauth_access_grants" ("token");
-- oauth_access_tokens definição
CREATE TABLE "oauth_access_tokens" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "token" varchar NOT NULL, "refresh_token" varchar, "expires_in" integer, "revoked_at" datetime, "created_at" datetime NOT NULL, "scopes" varchar, "application_id" bigint, "resource_owner_id" bigint, "last_used_at" datetime, "last_used_ip" varchar, CONSTRAINT "fk_rails_732cb83ab7"
FOREIGN KEY ("application_id")
REFERENCES "oauth_applications" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_e84df68546"
FOREIGN KEY ("resource_owner_id")
REFERENCES "users" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_oauth_access_tokens_on_refresh_token" ON "oauth_access_tokens" ("refresh_token") WHERE (refresh_token IS NOT NULL);
CREATE INDEX "index_oauth_access_tokens_on_resource_owner_id" ON "oauth_access_tokens" ("resource_owner_id") WHERE (resource_owner_id IS NOT NULL);
CREATE UNIQUE INDEX "index_oauth_access_tokens_on_token" ON "oauth_access_tokens" ("token");
-- oauth_applications definição
CREATE TABLE "oauth_applications" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "uid" varchar NOT NULL, "secret" varchar NOT NULL, "redirect_uri" text NOT NULL, "scopes" varchar DEFAULT '' NOT NULL, "created_at" datetime, "updated_at" datetime, "superapp" boolean DEFAULT 0 NOT NULL, "website" varchar, "owner_type" varchar, "owner_id" bigint, "confidential" boolean DEFAULT 1 NOT NULL, CONSTRAINT "fk_b0988c7c0a"
FOREIGN KEY ("owner_id")
REFERENCES "users" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_oauth_applications_on_owner_id_and_owner_type" ON "oauth_applications" ("owner_id", "owner_type");
CREATE INDEX "index_oauth_applications_on_superapp" ON "oauth_applications" ("superapp") WHERE (superapp = true);
CREATE UNIQUE INDEX "index_oauth_applications_on_uid" ON "oauth_applications" ("uid");
-- reports definição
CREATE TABLE "reports" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "status_ids" bigint NOT NULL, "comment" text DEFAULT '' NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "account_id" bigint NOT NULL, "action_taken_by_account_id" bigint, "target_account_id" bigint NOT NULL, "assigned_account_id" bigint, "uri" varchar, "forwarded" boolean, "category" integer DEFAULT 0 NOT NULL, "action_taken_at" datetime, "rule_ids" bigint, "application_id" bigint, CONSTRAINT "fk_rails_126d07513e"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_4e7a498fb4"
FOREIGN KEY ("assigned_account_id")
REFERENCES "accounts" ("id")
ON DELETE SET NULL, CONSTRAINT "fk_rails_e8e172880e"
FOREIGN KEY ("action_taken_by_account_id")
REFERENCES "accounts" ("id")
ON DELETE SET NULL, CONSTRAINT "fk_rails_66528197fd"
FOREIGN KEY ("target_account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_3deb8c7acb"
FOREIGN KEY ("application_id")
REFERENCES "oauth_applications" ("id")
ON DELETE SET NULL);
CREATE INDEX "index_reports_on_account_id" ON "reports" ("account_id");
CREATE INDEX "index_reports_on_action_taken_by_account_id" ON "reports" ("action_taken_by_account_id") WHERE (action_taken_by_account_id IS NOT NULL);
CREATE INDEX "index_reports_on_assigned_account_id" ON "reports" ("assigned_account_id") WHERE (assigned_account_id IS NOT NULL);
CREATE INDEX "index_reports_on_target_account_id" ON "reports" ("target_account_id");
-- report_notes definição
CREATE TABLE "report_notes" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "content" text NOT NULL, "report_id" bigint NOT NULL, "account_id" bigint NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, CONSTRAINT "fk_rails_cae66353f3"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_7fa83a61eb"
FOREIGN KEY ("report_id")
REFERENCES "reports" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_report_notes_on_account_id" ON "report_notes" ("account_id");
CREATE INDEX "index_report_notes_on_report_id" ON "report_notes" ("report_id");
-- session_activations definição
CREATE TABLE "session_activations" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "session_id" varchar NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "user_agent" varchar DEFAULT '' NOT NULL, "ip" varchar, "access_token_id" bigint, "user_id" bigint NOT NULL, "web_push_subscription_id" bigint, CONSTRAINT "fk_rails_a0d14b4784"
FOREIGN KEY ("access_token_id")
REFERENCES "oauth_access_tokens" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_e5fda67334"
FOREIGN KEY ("user_id")
REFERENCES "users" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_session_activations_on_access_token_id" ON "session_activations" ("access_token_id");
CREATE UNIQUE INDEX "index_session_activations_on_session_id" ON "session_activations" ("session_id");
CREATE INDEX "index_session_activations_on_user_id" ON "session_activations" ("user_id");
-- users definição
CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar DEFAULT '' NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "encrypted_password" varchar DEFAULT '' NOT NULL, "reset_password_token" varchar, "reset_password_sent_at" datetime, "sign_in_count" integer DEFAULT 0 NOT NULL, "current_sign_in_at" datetime, "last_sign_in_at" datetime, "confirmation_token" varchar, "confirmed_at" datetime, "confirmation_sent_at" datetime, "unconfirmed_email" varchar, "locale" varchar, "encrypted_otp_secret" varchar, "encrypted_otp_secret_iv" varchar, "encrypted_otp_secret_salt" varchar, "consumed_timestep" integer, "otp_required_for_login" boolean DEFAULT 0 NOT NULL, "last_emailed_at" datetime, "otp_backup_codes" varchar DEFAULT '[]', "account_id" bigint NOT NULL, "disabled" boolean DEFAULT 0 NOT NULL, "invite_id" bigint, "chosen_languages" varchar DEFAULT '[]', "created_by_application_id" bigint, "approved" boolean DEFAULT 1 NOT NULL, "sign_in_token" varchar, "sign_in_token_sent_at" datetime, "webauthn_id" varchar, "sign_up_ip" varchar, "skip_sign_in_token" boolean, "role_id" bigint, "settings" text, "time_zone" varchar, "otp_secret" varchar, "age_verified_at" datetime(6), CONSTRAINT "fk_rails_ecc9536e7c"
FOREIGN KEY ("created_by_application_id")
REFERENCES "oauth_applications" ("id")
ON DELETE SET NULL, CONSTRAINT "fk_rails_61ac11da2b"
FOREIGN KEY ("account_id")
REFERENCES "accounts" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_8fb2a43e88"
FOREIGN KEY ("invite_id")
REFERENCES "invites" ("id")
ON DELETE SET NULL, CONSTRAINT "fk_rails_642f17018b"
FOREIGN KEY ("role_id")
REFERENCES "user_roles" ("id")
ON DELETE SET NULL);
CREATE INDEX "index_users_on_account_id" ON "users" ("account_id");
CREATE UNIQUE INDEX "index_users_on_confirmation_token" ON "users" ("confirmation_token");
CREATE INDEX "index_users_on_created_by_application_id" ON "users" ("created_by_application_id") WHERE (created_by_application_id IS NOT NULL);
CREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email");
CREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token") WHERE (reset_password_token IS NOT NULL);
CREATE INDEX "index_users_on_role_id" ON "users" ("role_id") WHERE (role_id IS NOT NULL);
CREATE INDEX "index_users_on_unconfirmed_email" ON "users" ("unconfirmed_email") WHERE (unconfirmed_email IS NOT NULL);
-- user_invite_requests definição
CREATE TABLE "user_invite_requests" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" bigint NOT NULL, "text" text, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, CONSTRAINT "fk_rails_3773f15361"
FOREIGN KEY ("user_id")
REFERENCES "users" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_user_invite_requests_on_user_id" ON "user_invite_requests" ("user_id");
-- webauthn_credentials definição
CREATE TABLE "webauthn_credentials" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "external_id" varchar NOT NULL, "public_key" varchar NOT NULL, "nickname" varchar NOT NULL, "sign_count" bigint DEFAULT 0 NOT NULL, "user_id" bigint, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, CONSTRAINT "fk_rails_a4355aef77"
FOREIGN KEY ("user_id")
REFERENCES "users" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_webauthn_credentials_on_external_id" ON "webauthn_credentials" ("external_id");
CREATE UNIQUE INDEX "index_webauthn_credentials_on_user_id_and_nickname" ON "webauthn_credentials" ("user_id", "nickname");
-- web_push_subscriptions definição
CREATE TABLE "web_push_subscriptions" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "endpoint" varchar NOT NULL, "key_p256dh" varchar NOT NULL, "key_auth" varchar NOT NULL, "data" json, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "access_token_id" bigint NOT NULL, "user_id" bigint NOT NULL, "standard" boolean DEFAULT 0 NOT NULL, CONSTRAINT "fk_rails_751a9f390b"
FOREIGN KEY ("access_token_id")
REFERENCES "oauth_access_tokens" ("id")
ON DELETE CASCADE, CONSTRAINT "fk_rails_b006f28dac"
FOREIGN KEY ("user_id")
REFERENCES "users" ("id")
ON DELETE CASCADE);
CREATE INDEX "index_web_push_subscriptions_on_access_token_id" ON "web_push_subscriptions" ("access_token_id") WHERE (access_token_id IS NOT NULL);
CREATE INDEX "index_web_push_subscriptions_on_user_id" ON "web_push_subscriptions" ("user_id");
-- web_settings definição
CREATE TABLE "web_settings" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "data" json, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "user_id" bigint NOT NULL, CONSTRAINT "fk_11910667b2"
FOREIGN KEY ("user_id")
REFERENCES "users" ("id")
ON DELETE CASCADE);
CREATE UNIQUE INDEX "index_web_settings_on_user_id" ON "web_settings" ("user_id");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment