Files
discourse/migrations/db/intermediate_db_schema/100-base-schema.sql
Gerhard Schlager 17ba19c7ae REFACTOR: Code generator for migrations IntemerdiateDB
* Splits the existing script into multiple classes
* Adds command for generating IntermediateDB schema (`migrations/bin/cli schema generate`)
* Changes the syntax of the IntermediateDB schema config
* Adds validation for the schema config
* It uses YAML schema aka JSON schema to validate the config file
* It generates the SQL schema file and Ruby classes for storing data in the IntermediateDB
2025-04-07 17:22:36 +02:00

106 lines
4.3 KiB
SQL

-- This file is auto-generated from the IntermediateDB schema. To make changes,
-- update the "config/intermediate_db.yml" configuration file and then run
-- `bin/cli schema generate` to regenerate this file.
CREATE TABLE user_emails
(
email TEXT NOT NULL PRIMARY KEY,
created_at DATETIME NOT NULL,
"primary" BOOLEAN,
user_id NUMERIC NOT NULL
);
CREATE TABLE user_options
(
user_id NUMERIC NOT NULL PRIMARY KEY,
allow_private_messages BOOLEAN,
auto_track_topics_after_msecs INTEGER,
automatically_unpin_topics BOOLEAN,
bookmark_auto_delete_preference INTEGER,
chat_email_frequency INTEGER,
chat_enabled BOOLEAN,
chat_header_indicator_preference INTEGER,
chat_quick_reaction_type INTEGER,
chat_quick_reactions_custom TEXT,
chat_send_shortcut INTEGER,
chat_separate_sidebar_mode INTEGER,
chat_sound TEXT,
color_scheme_id NUMERIC,
dark_scheme_id NUMERIC,
default_calendar INTEGER,
digest_after_minutes INTEGER,
dismissed_channel_retention_reminder BOOLEAN,
dismissed_dm_retention_reminder BOOLEAN,
dynamic_favicon BOOLEAN,
email_digests BOOLEAN,
email_in_reply_to BOOLEAN,
email_level INTEGER,
email_messages_level INTEGER,
email_previous_replies INTEGER,
enable_allowed_pm_users BOOLEAN,
enable_defer BOOLEAN,
enable_experimental_sidebar BOOLEAN,
enable_quoting BOOLEAN,
enable_smart_lists BOOLEAN,
external_links_in_new_tab BOOLEAN,
hide_presence BOOLEAN,
hide_profile BOOLEAN,
hide_profile_and_presence BOOLEAN,
homepage_id NUMERIC,
ignore_channel_wide_mention BOOLEAN,
include_tl0_in_digests BOOLEAN,
last_redirected_to_top_at DATETIME,
like_notification_frequency INTEGER,
mailing_list_mode BOOLEAN,
mailing_list_mode_frequency INTEGER,
new_topic_duration_minutes INTEGER,
notification_level_when_replying INTEGER,
oldest_search_log_date DATETIME,
only_chat_push_notifications BOOLEAN,
seen_popups INTEGER,
show_thread_title_prompts BOOLEAN,
sidebar_link_to_filtered_list BOOLEAN,
sidebar_show_count_of_new_items BOOLEAN,
skip_new_user_tips BOOLEAN,
text_size_key INTEGER,
text_size_seq INTEGER,
theme_ids INTEGER,
theme_key_seq INTEGER,
timezone TEXT,
title_count_mode_key INTEGER,
topics_unread_when_closed BOOLEAN,
watched_precedence_over_muted BOOLEAN
);
CREATE TABLE users
(
original_id NUMERIC NOT NULL PRIMARY KEY,
active BOOLEAN,
admin BOOLEAN,
approved BOOLEAN,
approved_at DATETIME,
approved_by_id NUMERIC,
created_at DATETIME NOT NULL,
date_of_birth DATE,
first_seen_at DATETIME,
flair_group_id NUMERIC,
group_locked_trust_level INTEGER,
ip_address INET_TEXT,
last_seen_at DATETIME,
locale TEXT,
manual_locked_trust_level INTEGER,
moderator BOOLEAN,
name TEXT,
original_username TEXT,
primary_group_id NUMERIC,
registration_ip_address INET_TEXT,
silenced_till DATETIME,
staged BOOLEAN,
title TEXT,
trust_level INTEGER NOT NULL,
uploaded_avatar_id TEXT,
username TEXT NOT NULL,
views INTEGER
);