Skip to content

Instantly share code, notes, and snippets.

@scossar
Created August 18, 2023 03:33
Show Gist options
  • Save scossar/d92c4cea04a92422478785f264e7bd98 to your computer and use it in GitHub Desktop.
Save scossar/d92c4cea04a92422478785f264e7bd98 to your computer and use it in GitHub Desktop.
A list of the CREATE TABLE statements from the Discourse structure.sql file
--
-- Name: allowed_pm_users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.allowed_pm_users (
id bigint NOT NULL,
user_id integer NOT NULL,
allowed_pm_user_id integer NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: anonymous_users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.anonymous_users (
id bigint NOT NULL,
user_id integer NOT NULL,
master_user_id integer NOT NULL,
active boolean NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: api_key_scopes; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.api_key_scopes (
id bigint NOT NULL,
api_key_id integer NOT NULL,
resource character varying NOT NULL,
action character varying NOT NULL,
allowed_parameters json,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: api_keys; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.api_keys (
id integer NOT NULL,
user_id integer,
created_by_id integer,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
allowed_ips inet[],
hidden boolean DEFAULT false NOT NULL,
last_used_at timestamp without time zone,
revoked_at timestamp without time zone,
description text,
key_hash character varying NOT NULL,
truncated_key character varying NOT NULL
);
--
-- Name: application_requests; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.application_requests (
id integer NOT NULL,
date date NOT NULL,
req_type integer NOT NULL,
count integer DEFAULT 0 NOT NULL
);
--
-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.ar_internal_metadata (
key character varying NOT NULL,
value character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: assignments; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.assignments (
id bigint NOT NULL,
topic_id integer NOT NULL,
assigned_to_id integer NOT NULL,
assigned_by_user_id integer NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL,
assigned_to_type character varying NOT NULL,
target_id integer NOT NULL,
target_type character varying NOT NULL,
active boolean DEFAULT true,
note character varying
);
--
-- Name: associated_groups; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.associated_groups (
id bigint NOT NULL,
name character varying NOT NULL,
provider_name character varying NOT NULL,
provider_id character varying NOT NULL,
last_used timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: backup_draft_posts; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.backup_draft_posts (
id bigint NOT NULL,
user_id integer NOT NULL,
post_id integer NOT NULL,
key character varying NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: backup_draft_topics; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.backup_draft_topics (
id bigint NOT NULL,
user_id integer NOT NULL,
topic_id integer NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: backup_metadata; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.backup_metadata (
id bigint NOT NULL,
name character varying NOT NULL,
value character varying
);
--
-- Name: badge_groupings; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.badge_groupings (
id integer NOT NULL,
name character varying NOT NULL,
description text,
"position" integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: categories; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.categories (
id integer NOT NULL,
name character varying(50) NOT NULL,
color character varying(6) DEFAULT '0088CC'::character varying NOT NULL,
topic_id integer,
topic_count integer DEFAULT 0 NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
user_id integer NOT NULL,
topics_year integer DEFAULT 0,
topics_month integer DEFAULT 0,
topics_week integer DEFAULT 0,
slug character varying NOT NULL,
description text,
text_color character varying(6) DEFAULT 'FFFFFF'::character varying NOT NULL,
read_restricted boolean DEFAULT false NOT NULL,
auto_close_hours double precision,
post_count integer DEFAULT 0 NOT NULL,
latest_post_id integer,
latest_topic_id integer,
"position" integer,
parent_category_id integer,
posts_year integer DEFAULT 0,
posts_month integer DEFAULT 0,
posts_week integer DEFAULT 0,
email_in character varying,
email_in_allow_strangers boolean DEFAULT false,
topics_day integer DEFAULT 0,
posts_day integer DEFAULT 0,
allow_badges boolean DEFAULT true NOT NULL,
name_lower character varying(50) NOT NULL,
auto_close_based_on_last_post boolean DEFAULT false,
topic_template text,
contains_messages boolean,
sort_order character varying,
sort_ascending boolean,
uploaded_logo_id integer,
uploaded_background_id integer,
topic_featured_link_allowed boolean DEFAULT true,
all_topics_wiki boolean DEFAULT false NOT NULL,
show_subcategory_list boolean DEFAULT false,
num_featured_topics integer DEFAULT 3,
default_view character varying(50),
subcategory_list_style character varying(50) DEFAULT 'rows_with_featured_topics'::character varying,
default_top_period character varying(20) DEFAULT 'all'::character varying,
mailinglist_mirror boolean DEFAULT false NOT NULL,
minimum_required_tags integer DEFAULT 0 NOT NULL,
navigate_to_first_post_after_read boolean DEFAULT false NOT NULL,
search_priority integer DEFAULT 0,
allow_global_tags boolean DEFAULT false NOT NULL,
reviewable_by_group_id integer,
read_only_banner character varying,
default_list_filter character varying(20) DEFAULT 'all'::character varying,
allow_unlimited_owner_edits_on_first_post boolean DEFAULT false NOT NULL,
default_slow_mode_seconds integer
);
--
-- Name: posts; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.posts (
id integer NOT NULL,
user_id integer,
topic_id integer NOT NULL,
post_number integer NOT NULL,
raw text NOT NULL,
cooked text NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
reply_to_post_number integer,
reply_count integer DEFAULT 0 NOT NULL,
quote_count integer DEFAULT 0 NOT NULL,
deleted_at timestamp without time zone,
off_topic_count integer DEFAULT 0 NOT NULL,
like_count integer DEFAULT 0 NOT NULL,
incoming_link_count integer DEFAULT 0 NOT NULL,
bookmark_count integer DEFAULT 0 NOT NULL,
score double precision,
reads integer DEFAULT 0 NOT NULL,
post_type integer DEFAULT 1 NOT NULL,
sort_order integer,
last_editor_id integer,
hidden boolean DEFAULT false NOT NULL,
hidden_reason_id integer,
notify_moderators_count integer DEFAULT 0 NOT NULL,
spam_count integer DEFAULT 0 NOT NULL,
illegal_count integer DEFAULT 0 NOT NULL,
inappropriate_count integer DEFAULT 0 NOT NULL,
last_version_at timestamp without time zone NOT NULL,
user_deleted boolean DEFAULT false NOT NULL,
reply_to_user_id integer,
percent_rank double precision DEFAULT 1.0,
notify_user_count integer DEFAULT 0 NOT NULL,
like_score integer DEFAULT 0 NOT NULL,
deleted_by_id integer,
edit_reason character varying,
word_count integer,
version integer DEFAULT 1 NOT NULL,
cook_method integer DEFAULT 1 NOT NULL,
wiki boolean DEFAULT false NOT NULL,
baked_at timestamp without time zone,
baked_version integer,
hidden_at timestamp without time zone,
self_edits integer DEFAULT 0 NOT NULL,
reply_quoted boolean DEFAULT false NOT NULL,
via_email boolean DEFAULT false NOT NULL,
raw_email text,
public_version integer DEFAULT 1 NOT NULL,
action_code character varying,
locked_by_id integer,
image_upload_id bigint
);
--
-- Name: TABLE posts; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON TABLE public.posts IS 'If you want to query public posts only, use the badge_posts view.';
--
-- Name: COLUMN posts.post_number; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON COLUMN public.posts.post_number IS 'The position of this post in the topic. The pair (topic_id, post_number) forms a natural key on the posts table.';
--
-- Name: COLUMN posts.raw; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON COLUMN public.posts.raw IS 'The raw Markdown that the user entered into the composer.';
--
-- Name: COLUMN posts.cooked; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON COLUMN public.posts.cooked IS 'The processed HTML that is presented in a topic.';
--
-- Name: COLUMN posts.reply_to_post_number; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON COLUMN public.posts.reply_to_post_number IS 'If this post is a reply to another, this column is the post_number of the post it''s replying to. [FKEY posts.topic_id, posts.post_number]';
--
-- Name: COLUMN posts.reply_quoted; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON COLUMN public.posts.reply_quoted IS 'This column is true if the post contains a quote-reply, which causes the in-reply-to indicator to be absent.';
--
-- Name: topics; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.topics (
id integer NOT NULL,
title character varying NOT NULL,
last_posted_at timestamp without time zone,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
views integer DEFAULT 0 NOT NULL,
posts_count integer DEFAULT 0 NOT NULL,
user_id integer,
last_post_user_id integer NOT NULL,
reply_count integer DEFAULT 0 NOT NULL,
featured_user1_id integer,
featured_user2_id integer,
featured_user3_id integer,
deleted_at timestamp without time zone,
highest_post_number integer DEFAULT 0 NOT NULL,
like_count integer DEFAULT 0 NOT NULL,
incoming_link_count integer DEFAULT 0 NOT NULL,
category_id integer,
visible boolean DEFAULT true NOT NULL,
moderator_posts_count integer DEFAULT 0 NOT NULL,
closed boolean DEFAULT false NOT NULL,
archived boolean DEFAULT false NOT NULL,
bumped_at timestamp without time zone NOT NULL,
has_summary boolean DEFAULT false NOT NULL,
archetype character varying DEFAULT 'regular'::character varying NOT NULL,
featured_user4_id integer,
notify_moderators_count integer DEFAULT 0 NOT NULL,
spam_count integer DEFAULT 0 NOT NULL,
pinned_at timestamp without time zone,
score double precision,
percent_rank double precision DEFAULT 1.0 NOT NULL,
subtype character varying,
slug character varying,
deleted_by_id integer,
participant_count integer DEFAULT 1,
word_count integer,
excerpt character varying,
pinned_globally boolean DEFAULT false NOT NULL,
pinned_until timestamp without time zone,
fancy_title character varying,
highest_staff_post_number integer DEFAULT 0 NOT NULL,
featured_link character varying,
reviewable_score double precision DEFAULT 0.0 NOT NULL,
image_upload_id bigint,
slow_mode_seconds integer DEFAULT 0 NOT NULL,
bannered_until timestamp without time zone,
external_id character varying,
CONSTRAINT has_category_id CHECK (((category_id IS NOT NULL) OR ((archetype)::text <> 'regular'::text))),
CONSTRAINT pm_has_no_category CHECK (((category_id IS NULL) OR ((archetype)::text <> 'private_message'::text)))
);
--
-- Name: TABLE topics; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON TABLE public.topics IS 'To query public topics only: SELECT ... FROM topics t LEFT INNER JOIN categories c ON (t.category_id = c.id AND c.read_restricted = false)';
--
-- Name: badge_posts; Type: VIEW; Schema: public; Owner: -
--
CREATE VIEW public.badge_posts AS
SELECT p.id,
p.user_id,
p.topic_id,
p.post_number,
p.raw,
p.cooked,
p.created_at,
p.updated_at,
p.reply_to_post_number,
p.reply_count,
p.quote_count,
p.deleted_at,
p.off_topic_count,
p.like_count,
p.incoming_link_count,
p.bookmark_count,
p.score,
p.reads,
p.post_type,
p.sort_order,
p.last_editor_id,
p.hidden,
p.hidden_reason_id,
p.notify_moderators_count,
p.spam_count,
p.illegal_count,
p.inappropriate_count,
p.last_version_at,
p.user_deleted,
p.reply_to_user_id,
p.percent_rank,
p.notify_user_count,
p.like_score,
p.deleted_by_id,
p.edit_reason,
p.word_count,
p.version,
p.cook_method,
p.wiki,
p.baked_at,
p.baked_version,
p.hidden_at,
p.self_edits,
p.reply_quoted,
p.via_email,
p.raw_email,
p.public_version,
p.action_code,
p.locked_by_id,
p.image_upload_id
FROM ((public.posts p
JOIN public.topics t ON ((t.id = p.topic_id)))
JOIN public.categories c ON ((c.id = t.category_id)))
WHERE (c.allow_badges AND (p.deleted_at IS NULL) AND (t.deleted_at IS NULL) AND (NOT c.read_restricted) AND t.visible AND (p.post_type = ANY (ARRAY[1, 2, 3])));
--
-- Name: badge_types; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.badge_types (
id integer NOT NULL,
name character varying NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: badges; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.badges (
id integer NOT NULL,
name character varying NOT NULL,
description text,
badge_type_id integer NOT NULL,
grant_count integer DEFAULT 0 NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
allow_title boolean DEFAULT false NOT NULL,
multiple_grant boolean DEFAULT false NOT NULL,
icon character varying DEFAULT 'fa-certificate'::character varying,
listable boolean DEFAULT true,
target_posts boolean DEFAULT false,
query text,
enabled boolean DEFAULT true NOT NULL,
auto_revoke boolean DEFAULT true NOT NULL,
badge_grouping_id integer DEFAULT 5 NOT NULL,
trigger integer,
show_posts boolean DEFAULT false NOT NULL,
system boolean DEFAULT false NOT NULL,
image character varying(255),
long_description text,
image_upload_id integer
);
--
-- Name: bookmarks; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.bookmarks (
id bigint NOT NULL,
user_id bigint NOT NULL,
post_id bigint,
name character varying(100),
reminder_at timestamp without time zone,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL,
reminder_last_sent_at timestamp without time zone,
reminder_set_at timestamp without time zone,
auto_delete_preference integer DEFAULT 0 NOT NULL,
pinned boolean DEFAULT false,
for_topic boolean DEFAULT false NOT NULL,
bookmarkable_id integer,
bookmarkable_type character varying,
CONSTRAINT enforce_post_id_or_bookmarkable CHECK (((post_id IS NOT NULL) OR ((bookmarkable_id IS NOT NULL) AND (bookmarkable_type IS NOT NULL))))
);
--
-- Name: calendar_events; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.calendar_events (
id bigint NOT NULL,
topic_id integer NOT NULL,
post_id integer,
post_number integer,
user_id integer,
username character varying,
description character varying,
start_date timestamp without time zone NOT NULL,
end_date timestamp without time zone,
recurrence character varying,
region character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
timezone character varying
);
--
-- Name: categories_web_hooks; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.categories_web_hooks (
web_hook_id integer NOT NULL,
category_id integer NOT NULL
);
--
-- Name: category_custom_fields; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.category_custom_fields (
id integer NOT NULL,
category_id integer NOT NULL,
name character varying(256) NOT NULL,
value text,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: category_featured_topics; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.category_featured_topics (
category_id integer NOT NULL,
topic_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
rank integer DEFAULT 0 NOT NULL,
id integer NOT NULL
);
--
-- Name: category_groups; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.category_groups (
id integer NOT NULL,
category_id integer NOT NULL,
group_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
permission_type integer DEFAULT 1
);
--
-- Name: category_required_tag_groups; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.category_required_tag_groups (
id bigint NOT NULL,
category_id bigint NOT NULL,
tag_group_id bigint NOT NULL,
min_count integer DEFAULT 1 NOT NULL,
"order" integer DEFAULT 1 NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: category_search_data; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.category_search_data (
category_id integer NOT NULL,
search_data tsvector,
raw_data text,
locale text,
version integer DEFAULT 0
);
--
-- Name: category_tag_groups; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.category_tag_groups (
id integer NOT NULL,
category_id integer NOT NULL,
tag_group_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: category_tag_stats; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.category_tag_stats (
id bigint NOT NULL,
category_id bigint NOT NULL,
tag_id bigint NOT NULL,
topic_count integer DEFAULT 0 NOT NULL
);
--
-- Name: category_tags; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.category_tags (
id integer NOT NULL,
category_id integer NOT NULL,
tag_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: category_users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.category_users (
id integer NOT NULL,
category_id integer NOT NULL,
user_id integer NOT NULL,
notification_level integer NOT NULL,
last_seen_at timestamp without time zone
);
--
-- Name: child_themes; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.child_themes (
id integer NOT NULL,
parent_theme_id integer,
child_theme_id integer,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: color_scheme_colors; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.color_scheme_colors (
id integer NOT NULL,
name character varying NOT NULL,
hex character varying NOT NULL,
color_scheme_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: color_schemes; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.color_schemes (
id integer NOT NULL,
name character varying NOT NULL,
version integer DEFAULT 1 NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
via_wizard boolean DEFAULT false NOT NULL,
base_scheme_id character varying,
theme_id integer,
user_selectable boolean DEFAULT false NOT NULL
);
--
-- Name: custom_emojis; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.custom_emojis (
id integer NOT NULL,
name character varying NOT NULL,
upload_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
"group" character varying(20)
);
--
-- Name: data_explorer_queries; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.data_explorer_queries (
id bigint NOT NULL,
name character varying,
description text,
sql text DEFAULT 'SELECT 1'::text NOT NULL,
user_id integer,
last_run_at timestamp without time zone,
hidden boolean DEFAULT false NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: data_explorer_query_groups; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.data_explorer_query_groups (
id bigint NOT NULL,
query_id integer,
group_id integer
);
--
-- Name: developers; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.developers (
id integer NOT NULL,
user_id integer NOT NULL
);
--
-- Name: directory_columns; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.directory_columns (
id bigint NOT NULL,
name character varying,
automatic_position integer,
icon character varying,
user_field_id integer,
enabled boolean NOT NULL,
"position" integer NOT NULL,
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
automatic boolean DEFAULT true NOT NULL,
type integer DEFAULT 0 NOT NULL
);
--
-- Name: directory_items; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.directory_items (
id integer NOT NULL,
period_type integer NOT NULL,
user_id integer NOT NULL,
likes_received integer NOT NULL,
likes_given integer NOT NULL,
topics_entered integer NOT NULL,
topic_count integer NOT NULL,
post_count integer NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
days_visited integer DEFAULT 0 NOT NULL,
posts_read integer DEFAULT 0 NOT NULL,
solutions integer DEFAULT 0
);
--
-- Name: discourse_automation_automations; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.discourse_automation_automations (
id bigint NOT NULL,
name character varying NOT NULL,
script character varying NOT NULL,
enabled boolean DEFAULT false NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL,
last_updated_by_id integer NOT NULL,
trigger character varying
);
--
-- Name: discourse_automation_fields; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.discourse_automation_fields (
id bigint NOT NULL,
automation_id integer NOT NULL,
metadata jsonb DEFAULT '{}'::jsonb NOT NULL,
component character varying NOT NULL,
name character varying NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL,
target character varying
);
--
-- Name: discourse_automation_pending_automations; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.discourse_automation_pending_automations (
id bigint NOT NULL,
automation_id integer NOT NULL,
execute_at timestamp without time zone NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: discourse_automation_pending_pms; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.discourse_automation_pending_pms (
id bigint NOT NULL,
target_usernames character varying[],
sender character varying,
title character varying,
raw character varying,
automation_id integer NOT NULL,
execute_at timestamp without time zone NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: discourse_automation_user_global_notices; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.discourse_automation_user_global_notices (
id bigint NOT NULL,
user_id integer NOT NULL,
notice text NOT NULL,
identifier character varying NOT NULL,
level character varying DEFAULT 'info'::character varying,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: discourse_calendar_post_event_dates; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.discourse_calendar_post_event_dates (
id bigint NOT NULL,
event_id integer,
starts_at timestamp without time zone,
ends_at timestamp without time zone,
reminder_counter integer DEFAULT 0,
event_will_start_sent_at timestamp without time zone,
event_started_sent_at timestamp without time zone,
finished_at timestamp without time zone,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: discourse_post_event_events; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.discourse_post_event_events (
id bigint NOT NULL,
status integer DEFAULT 0 NOT NULL,
original_starts_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
original_ends_at timestamp without time zone,
deleted_at timestamp without time zone,
raw_invitees character varying[],
name character varying,
url character varying(1000),
custom_fields jsonb DEFAULT '{}'::jsonb NOT NULL,
reminders character varying,
recurrence character varying,
timezone character varying
);
--
-- Name: discourse_post_event_invitees; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.discourse_post_event_invitees (
id bigint NOT NULL,
post_id integer NOT NULL,
user_id integer NOT NULL,
status integer,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
notified boolean DEFAULT false NOT NULL
);
--
-- Name: discourse_reactions_reaction_users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.discourse_reactions_reaction_users (
id bigint NOT NULL,
reaction_id integer,
user_id integer,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL,
post_id integer
);
--
-- Name: discourse_reactions_reactions; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.discourse_reactions_reactions (
id bigint NOT NULL,
post_id integer,
reaction_type integer,
reaction_value character varying,
reaction_users_count integer,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: discourse_staff_alias_users_post_revisions_links; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.discourse_staff_alias_users_post_revisions_links (
id bigint NOT NULL,
user_id bigint NOT NULL,
post_revision_id bigint NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: discourse_staff_alias_users_posts_links; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.discourse_staff_alias_users_posts_links (
id bigint NOT NULL,
user_id bigint NOT NULL,
post_id bigint NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: discourse_subscriptions_customers; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.discourse_subscriptions_customers (
id bigint NOT NULL,
customer_id character varying NOT NULL,
product_id character varying,
user_id bigint,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: discourse_subscriptions_products; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.discourse_subscriptions_products (
id bigint NOT NULL,
external_id character varying NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: discourse_subscriptions_subscriptions; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.discourse_subscriptions_subscriptions (
id bigint NOT NULL,
customer_id integer NOT NULL,
external_id character varying NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: discourse_voting_category_settings; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.discourse_voting_category_settings (
id bigint NOT NULL,
category_id integer,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: discourse_voting_topic_vote_count; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.discourse_voting_topic_vote_count (
id bigint NOT NULL,
topic_id integer,
votes_count integer,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: discourse_voting_votes; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.discourse_voting_votes (
id bigint NOT NULL,
topic_id integer,
user_id integer,
archive boolean DEFAULT false,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: dismissed_topic_users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.dismissed_topic_users (
id bigint NOT NULL,
user_id integer,
topic_id integer,
created_at timestamp without time zone
);
--
-- Name: do_not_disturb_timings; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.do_not_disturb_timings (
id bigint NOT NULL,
user_id integer NOT NULL,
starts_at timestamp without time zone NOT NULL,
ends_at timestamp without time zone NOT NULL,
scheduled boolean DEFAULT false
);
--
-- Name: draft_sequences; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.draft_sequences (
id integer NOT NULL,
user_id integer NOT NULL,
draft_key character varying NOT NULL,
sequence bigint NOT NULL
);
--
-- Name: drafts; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.drafts (
id integer NOT NULL,
user_id integer NOT NULL,
draft_key character varying NOT NULL,
data text NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
sequence bigint DEFAULT 0 NOT NULL,
revisions integer DEFAULT 1 NOT NULL,
owner character varying
);
--
-- Name: email_change_requests; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.email_change_requests (
id integer NOT NULL,
user_id integer NOT NULL,
old_email character varying,
new_email character varying NOT NULL,
old_email_token_id integer,
new_email_token_id integer,
change_state integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
requested_by_user_id integer
);
--
-- Name: email_logs; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.email_logs (
id integer NOT NULL,
to_address character varying NOT NULL,
email_type character varying NOT NULL,
user_id integer,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
post_id integer,
bounce_key uuid,
bounced boolean DEFAULT false NOT NULL,
message_id character varying,
smtp_group_id integer,
cc_addresses text,
cc_user_ids integer[],
raw text,
topic_id integer,
bounce_error_code character varying
);
--
-- Name: email_tokens; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.email_tokens (
id integer NOT NULL,
user_id integer NOT NULL,
email character varying NOT NULL,
confirmed boolean DEFAULT false NOT NULL,
expired boolean DEFAULT false NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
token_hash character varying NOT NULL,
scope integer
);
--
-- Name: embeddable_hosts; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.embeddable_hosts (
id integer NOT NULL,
host character varying NOT NULL,
category_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
allowed_paths character varying,
class_name character varying
);
--
-- Name: external_upload_stubs; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.external_upload_stubs (
id bigint NOT NULL,
key character varying NOT NULL,
original_filename character varying NOT NULL,
status integer DEFAULT 1 NOT NULL,
unique_identifier uuid NOT NULL,
created_by_id integer NOT NULL,
upload_type character varying NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL,
multipart boolean DEFAULT false NOT NULL,
external_upload_identifier character varying,
filesize bigint NOT NULL
);
--
-- Name: github_commits; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.github_commits (
id bigint NOT NULL,
repo_id bigint NOT NULL,
sha character varying(40) NOT NULL,
email character varying(513) NOT NULL,
committed_at timestamp without time zone NOT NULL,
role_id integer NOT NULL,
merge_commit boolean DEFAULT false NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: github_repos; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.github_repos (
id bigint NOT NULL,
name character varying(255) NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: given_daily_likes; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.given_daily_likes (
user_id integer NOT NULL,
likes_given integer NOT NULL,
given_date date NOT NULL,
limit_reached boolean DEFAULT false NOT NULL
);
--
-- Name: group_archived_messages; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.group_archived_messages (
id integer NOT NULL,
group_id integer NOT NULL,
topic_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: group_associated_groups; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.group_associated_groups (
id bigint NOT NULL,
group_id bigint NOT NULL,
associated_group_id bigint NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: group_category_notification_defaults; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.group_category_notification_defaults (
id bigint NOT NULL,
group_id integer NOT NULL,
category_id integer NOT NULL,
notification_level integer NOT NULL
);
--
-- Name: group_custom_fields; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.group_custom_fields (
id integer NOT NULL,
group_id integer NOT NULL,
name character varying(256) NOT NULL,
value text,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: group_histories; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.group_histories (
id integer NOT NULL,
group_id integer NOT NULL,
acting_user_id integer NOT NULL,
target_user_id integer,
action integer NOT NULL,
subject character varying,
prev_value text,
new_value text,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: group_mentions; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.group_mentions (
id integer NOT NULL,
post_id integer,
group_id integer,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: group_requests; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.group_requests (
id bigint NOT NULL,
group_id integer,
user_id integer,
reason text,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: group_tag_notification_defaults; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.group_tag_notification_defaults (
id bigint NOT NULL,
group_id integer NOT NULL,
tag_id integer NOT NULL,
notification_level integer NOT NULL
);
--
-- Name: group_users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.group_users (
id integer NOT NULL,
group_id integer NOT NULL,
user_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
owner boolean DEFAULT false NOT NULL,
notification_level integer DEFAULT 2 NOT NULL,
first_unread_pm_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);
--
-- Name: groups; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.groups (
id integer NOT NULL,
name character varying NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
automatic boolean DEFAULT false NOT NULL,
user_count integer DEFAULT 0 NOT NULL,
automatic_membership_email_domains text,
primary_group boolean DEFAULT false NOT NULL,
title character varying,
grant_trust_level integer,
incoming_email character varying,
has_messages boolean DEFAULT false NOT NULL,
flair_url character varying,
flair_bg_color character varying,
flair_color character varying,
bio_raw text,
bio_cooked text,
allow_membership_requests boolean DEFAULT false NOT NULL,
full_name character varying,
default_notification_level integer DEFAULT 3 NOT NULL,
visibility_level integer DEFAULT 0 NOT NULL,
public_exit boolean DEFAULT false NOT NULL,
public_admission boolean DEFAULT false NOT NULL,
membership_request_template text,
messageable_level integer DEFAULT 0,
mentionable_level integer DEFAULT 0,
members_visibility_level integer DEFAULT 0 NOT NULL,
publish_read_state boolean DEFAULT false NOT NULL,
flair_icon character varying,
flair_upload_id integer,
smtp_server character varying,
smtp_port integer,
smtp_ssl boolean,
imap_server character varying,
imap_port integer,
imap_ssl boolean,
imap_mailbox_name character varying DEFAULT ''::character varying NOT NULL,
imap_uid_validity integer DEFAULT 0 NOT NULL,
imap_last_uid integer DEFAULT 0 NOT NULL,
email_username character varying,
email_password character varying,
imap_last_error text,
imap_old_emails integer,
imap_new_emails integer,
allow_unknown_sender_topic_replies boolean DEFAULT false NOT NULL,
smtp_enabled boolean DEFAULT false,
smtp_updated_at timestamp without time zone,
smtp_updated_by_id integer,
imap_enabled boolean DEFAULT false,
imap_updated_at timestamp without time zone,
imap_updated_by_id integer,
assignable_level integer DEFAULT 0 NOT NULL,
email_from_alias character varying
);
--
-- Name: groups_web_hooks; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.groups_web_hooks (
web_hook_id integer NOT NULL,
group_id integer NOT NULL
);
--
-- Name: ignored_users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.ignored_users (
id bigint NOT NULL,
user_id integer NOT NULL,
ignored_user_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
summarized_at timestamp without time zone,
expiring_at timestamp without time zone NOT NULL
);
--
-- Name: imap_sync_logs; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.imap_sync_logs (
id bigint NOT NULL,
level integer NOT NULL,
message character varying NOT NULL,
group_id bigint,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: incoming_domains; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.incoming_domains (
id integer NOT NULL,
name character varying(100) NOT NULL,
https boolean DEFAULT false NOT NULL,
port integer NOT NULL
);
--
-- Name: incoming_emails; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.incoming_emails (
id integer NOT NULL,
user_id integer,
topic_id integer,
post_id integer,
raw text,
error text,
message_id text,
from_address text,
to_addresses text,
cc_addresses text,
subject text,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
rejection_message text,
is_auto_generated boolean DEFAULT false,
is_bounce boolean DEFAULT false NOT NULL,
imap_uid_validity integer,
imap_uid integer,
imap_sync boolean,
imap_group_id bigint,
imap_missing boolean DEFAULT false NOT NULL,
created_via integer DEFAULT 0 NOT NULL
);
--
-- Name: incoming_links; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.incoming_links (
id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
user_id integer,
ip_address inet,
current_user_id integer,
post_id integer NOT NULL,
incoming_referer_id integer
);
--
-- Name: incoming_referers; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.incoming_referers (
id integer NOT NULL,
path character varying(1000) NOT NULL,
incoming_domain_id integer NOT NULL
);
--
-- Name: invited_groups; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.invited_groups (
id integer NOT NULL,
group_id integer,
invite_id integer,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: invited_users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.invited_users (
id bigint NOT NULL,
user_id integer,
invite_id integer NOT NULL,
redeemed_at timestamp without time zone,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: invites; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.invites (
id integer NOT NULL,
invite_key character varying(32) NOT NULL,
email character varying,
invited_by_id integer NOT NULL,
user_id integer,
redeemed_at timestamp without time zone,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
deleted_at timestamp without time zone,
deleted_by_id integer,
invalidated_at timestamp without time zone,
moderator boolean DEFAULT false NOT NULL,
custom_message text,
emailed_status integer,
max_redemptions_allowed integer DEFAULT 1 NOT NULL,
redemption_count integer DEFAULT 0 NOT NULL,
expires_at timestamp without time zone NOT NULL,
email_token character varying,
domain character varying
);
--
-- Name: javascript_caches; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.javascript_caches (
id bigint NOT NULL,
theme_field_id bigint,
digest character varying,
content text NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
theme_id bigint,
CONSTRAINT enforce_theme_or_theme_field CHECK ((((theme_id IS NOT NULL) AND (theme_field_id IS NULL)) OR ((theme_id IS NULL) AND (theme_field_id IS NOT NULL))))
);
--
-- Name: linked_topics; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.linked_topics (
id bigint NOT NULL,
topic_id bigint NOT NULL,
original_topic_id bigint NOT NULL,
sequence integer NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: message_bus; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.message_bus (
id integer NOT NULL,
name character varying,
context character varying,
data text,
created_at timestamp without time zone NOT NULL
);
--
-- Name: muted_users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.muted_users (
id integer NOT NULL,
user_id integer NOT NULL,
muted_user_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: notifications; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.notifications (
id integer NOT NULL,
notification_type integer NOT NULL,
user_id integer NOT NULL,
data character varying(1000) NOT NULL,
read boolean DEFAULT false NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
topic_id integer,
post_number integer,
post_action_id integer,
high_priority boolean DEFAULT false NOT NULL
);
--
-- Name: oauth2_user_infos; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.oauth2_user_infos (
id integer NOT NULL,
user_id integer NOT NULL,
uid character varying NOT NULL,
provider character varying NOT NULL,
email character varying,
name character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: onceoff_logs; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.onceoff_logs (
id integer NOT NULL,
job_name character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: optimized_images; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.optimized_images (
id integer NOT NULL,
sha1 character varying(40) NOT NULL,
extension character varying(10) NOT NULL,
width integer NOT NULL,
height integer NOT NULL,
upload_id integer NOT NULL,
url character varying NOT NULL,
filesize integer,
etag character varying,
version integer,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: permalinks; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.permalinks (
id integer NOT NULL,
url character varying(1000) NOT NULL,
topic_id integer,
post_id integer,
category_id integer,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
external_url character varying(1000),
tag_id integer
);
--
-- Name: plugin_store_rows; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.plugin_store_rows (
id integer NOT NULL,
plugin_name character varying NOT NULL,
key character varying NOT NULL,
type_name character varying NOT NULL,
value text
);
--
-- Name: policy_users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.policy_users (
id bigint NOT NULL,
post_policy_id integer NOT NULL,
user_id integer NOT NULL,
accepted_at timestamp without time zone,
revoked_at timestamp without time zone,
expired_at timestamp without time zone,
version character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: poll_options; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.poll_options (
id bigint NOT NULL,
poll_id bigint,
digest character varying NOT NULL,
html text NOT NULL,
anonymous_votes integer,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: poll_votes; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.poll_votes (
poll_id bigint,
poll_option_id bigint,
user_id bigint,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: polls; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.polls (
id bigint NOT NULL,
post_id bigint,
name character varying DEFAULT 'poll'::character varying NOT NULL,
close_at timestamp without time zone,
type integer DEFAULT 0 NOT NULL,
status integer DEFAULT 0 NOT NULL,
results integer DEFAULT 0 NOT NULL,
visibility integer DEFAULT 0 NOT NULL,
min integer,
max integer,
step integer,
anonymous_voters integer,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
chart_type integer DEFAULT 0 NOT NULL,
groups character varying,
title character varying
);
--
-- Name: post_action_types; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.post_action_types (
name_key character varying(50) NOT NULL,
is_flag boolean DEFAULT false NOT NULL,
icon character varying(20),
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
id integer NOT NULL,
"position" integer DEFAULT 0 NOT NULL,
score_bonus double precision DEFAULT 0.0 NOT NULL,
reviewable_priority integer DEFAULT 0 NOT NULL
);
--
-- Name: post_actions; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.post_actions (
id integer NOT NULL,
post_id integer NOT NULL,
user_id integer NOT NULL,
post_action_type_id integer NOT NULL,
deleted_at timestamp without time zone,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
deleted_by_id integer,
related_post_id integer,
staff_took_action boolean DEFAULT false NOT NULL,
deferred_by_id integer,
targets_topic boolean DEFAULT false NOT NULL,
agreed_at timestamp without time zone,
agreed_by_id integer,
deferred_at timestamp without time zone,
disagreed_at timestamp without time zone,
disagreed_by_id integer
);
--
-- Name: post_custom_fields; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.post_custom_fields (
id integer NOT NULL,
post_id integer NOT NULL,
name character varying(256) NOT NULL,
value text,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: post_details; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.post_details (
id integer NOT NULL,
post_id integer,
key character varying,
value character varying,
extra text,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: post_hotlinked_media; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.post_hotlinked_media (
id bigint NOT NULL,
post_id bigint NOT NULL,
url character varying NOT NULL,
status public.hotlinked_media_status NOT NULL,
upload_id bigint,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: post_policies; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.post_policies (
id bigint NOT NULL,
post_id bigint NOT NULL,
renew_start timestamp without time zone,
renew_days integer,
next_renew_at timestamp without time zone,
reminder character varying,
last_reminded_at timestamp without time zone,
version character varying,
group_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
renew_interval integer,
private boolean DEFAULT false NOT NULL
);
--
-- Name: post_replies; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.post_replies (
post_id integer,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
reply_post_id integer
);
--
-- Name: post_reply_keys; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.post_reply_keys (
id bigint NOT NULL,
user_id integer NOT NULL,
post_id integer NOT NULL,
reply_key uuid NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: post_revisions; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.post_revisions (
id integer NOT NULL,
user_id integer,
post_id integer,
modifications text,
number integer,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
hidden boolean DEFAULT false NOT NULL
);
--
-- Name: post_search_data; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.post_search_data (
post_id integer NOT NULL,
search_data tsvector,
raw_data text,
locale character varying,
version integer DEFAULT 0,
private_message boolean NOT NULL
);
--
-- Name: post_stats; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.post_stats (
id integer NOT NULL,
post_id integer,
drafts_saved integer,
typing_duration_msecs integer,
composer_open_duration_msecs integer,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: post_timings; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.post_timings (
topic_id integer NOT NULL,
post_number integer NOT NULL,
user_id integer NOT NULL,
msecs integer NOT NULL
);
--
-- Name: post_uploads; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.post_uploads (
id integer NOT NULL,
post_id integer NOT NULL,
upload_id integer NOT NULL
);
--
-- Name: published_pages; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.published_pages (
id bigint NOT NULL,
topic_id bigint NOT NULL,
slug character varying NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL,
public boolean DEFAULT false NOT NULL
);
--
-- Name: push_subscriptions; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.push_subscriptions (
id bigint NOT NULL,
user_id integer NOT NULL,
data character varying NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
error_count integer DEFAULT 0 NOT NULL,
first_error_at timestamp without time zone
);
--
-- Name: quoted_posts; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.quoted_posts (
id integer NOT NULL,
post_id integer NOT NULL,
quoted_post_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: remote_themes; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.remote_themes (
id integer NOT NULL,
remote_url character varying NOT NULL,
remote_version character varying,
local_version character varying,
about_url character varying,
license_url character varying,
commits_behind integer,
remote_updated_at timestamp without time zone,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
private_key text,
branch character varying,
last_error_text text,
authors character varying,
theme_version character varying,
minimum_discourse_version character varying,
maximum_discourse_version character varying
);
--
-- Name: reviewable_claimed_topics; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.reviewable_claimed_topics (
id bigint NOT NULL,
user_id integer NOT NULL,
topic_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: reviewable_histories; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.reviewable_histories (
id bigint NOT NULL,
reviewable_id integer NOT NULL,
reviewable_history_type integer NOT NULL,
status integer NOT NULL,
created_by_id integer NOT NULL,
edited json,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: reviewable_scores; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.reviewable_scores (
id bigint NOT NULL,
reviewable_id integer NOT NULL,
user_id integer NOT NULL,
reviewable_score_type integer NOT NULL,
status integer NOT NULL,
score double precision DEFAULT 0.0 NOT NULL,
take_action_bonus double precision DEFAULT 0.0 NOT NULL,
reviewed_by_id integer,
reviewed_at timestamp without time zone,
meta_topic_id integer,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
reason character varying,
user_accuracy_bonus double precision DEFAULT 0.0 NOT NULL
);
--
-- Name: reviewables; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.reviewables (
id bigint NOT NULL,
type character varying NOT NULL,
status integer DEFAULT 0 NOT NULL,
created_by_id integer NOT NULL,
reviewable_by_moderator boolean DEFAULT false NOT NULL,
reviewable_by_group_id integer,
category_id integer,
topic_id integer,
score double precision DEFAULT 0.0 NOT NULL,
potential_spam boolean DEFAULT false NOT NULL,
target_id integer,
target_type character varying,
target_created_by_id integer,
payload json,
version integer DEFAULT 0 NOT NULL,
latest_score timestamp without time zone,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
force_review boolean DEFAULT false NOT NULL,
reject_reason text
);
--
-- Name: scheduler_stats; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.scheduler_stats (
id integer NOT NULL,
name character varying NOT NULL,
hostname character varying NOT NULL,
pid integer NOT NULL,
duration_ms integer,
live_slots_start integer,
live_slots_finish integer,
started_at timestamp without time zone NOT NULL,
success boolean,
error text
);
--
-- Name: schema_migration_details; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.schema_migration_details (
id integer NOT NULL,
version character varying NOT NULL,
name character varying,
hostname character varying,
git_version character varying,
rails_version character varying,
duration integer,
direction character varying,
created_at timestamp without time zone NOT NULL
);
--
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.schema_migrations (
version character varying NOT NULL
);
--
-- Name: screened_emails; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.screened_emails (
id integer NOT NULL,
email character varying NOT NULL,
action_type integer NOT NULL,
match_count integer DEFAULT 0 NOT NULL,
last_match_at timestamp without time zone,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
ip_address inet
);
--
-- Name: screened_ip_addresses; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.screened_ip_addresses (
id integer NOT NULL,
ip_address inet NOT NULL,
action_type integer NOT NULL,
match_count integer DEFAULT 0 NOT NULL,
last_match_at timestamp without time zone,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: screened_urls; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.screened_urls (
id integer NOT NULL,
url character varying NOT NULL,
domain character varying NOT NULL,
action_type integer NOT NULL,
match_count integer DEFAULT 0 NOT NULL,
last_match_at timestamp without time zone,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
ip_address inet
);
--
-- Name: search_logs; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.search_logs (
id integer NOT NULL,
term character varying NOT NULL,
user_id integer,
ip_address inet,
search_result_id integer,
search_type integer NOT NULL,
created_at timestamp without time zone NOT NULL,
search_result_type integer
);
--
-- Name: shared_drafts; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.shared_drafts (
topic_id integer NOT NULL,
category_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
id bigint NOT NULL
);
--
-- Name: shelved_notifications; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.shelved_notifications (
id bigint NOT NULL,
notification_id integer NOT NULL
);
--
-- Name: single_sign_on_records; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.single_sign_on_records (
id integer NOT NULL,
user_id integer NOT NULL,
external_id character varying NOT NULL,
last_payload text NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
external_username character varying,
external_email character varying,
external_name character varying,
external_avatar_url character varying(1000),
external_profile_background_url character varying,
external_card_background_url character varying
);
--
-- Name: site_settings; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.site_settings (
id integer NOT NULL,
name character varying NOT NULL,
data_type integer NOT NULL,
value text,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: sitemaps; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.sitemaps (
id bigint NOT NULL,
name character varying NOT NULL,
last_posted_at timestamp without time zone NOT NULL,
enabled boolean DEFAULT true NOT NULL
);
--
-- Name: skipped_code_reviews; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.skipped_code_reviews (
id bigint NOT NULL,
topic_id integer NOT NULL,
user_id integer NOT NULL,
expires_at timestamp without time zone NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: skipped_email_logs; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.skipped_email_logs (
id bigint NOT NULL,
email_type character varying NOT NULL,
to_address character varying NOT NULL,
user_id integer,
post_id integer,
reason_type integer NOT NULL,
custom_reason text,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: stylesheet_cache; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.stylesheet_cache (
id integer NOT NULL,
target character varying NOT NULL,
digest character varying NOT NULL,
content text NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
theme_id integer DEFAULT '-1'::integer NOT NULL,
source_map text
);
--
-- Name: tag_group_memberships; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.tag_group_memberships (
id integer NOT NULL,
tag_id integer NOT NULL,
tag_group_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: tag_group_permissions; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.tag_group_permissions (
id bigint NOT NULL,
tag_group_id bigint NOT NULL,
group_id bigint NOT NULL,
permission_type integer DEFAULT 1 NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: tag_groups; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.tag_groups (
id integer NOT NULL,
name character varying NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
parent_tag_id integer,
one_per_topic boolean DEFAULT false
);
--
-- Name: tag_search_data; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.tag_search_data (
tag_id integer NOT NULL,
search_data tsvector,
raw_data text,
locale text,
version integer DEFAULT 0
);
--
-- Name: tag_users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.tag_users (
id integer NOT NULL,
tag_id integer NOT NULL,
user_id integer NOT NULL,
notification_level integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: tags; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.tags (
id integer NOT NULL,
name character varying NOT NULL,
topic_count integer DEFAULT 0 NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
pm_topic_count integer DEFAULT 0 NOT NULL,
target_tag_id integer,
description character varying
);
--
-- Name: tags_web_hooks; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.tags_web_hooks (
web_hook_id bigint NOT NULL,
tag_id bigint NOT NULL
);
--
-- Name: theme_fields; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.theme_fields (
id integer NOT NULL,
theme_id integer NOT NULL,
target_id integer NOT NULL,
name character varying(255) NOT NULL,
value text NOT NULL,
value_baked text,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
compiler_version character varying(50) DEFAULT 0 NOT NULL,
error character varying,
upload_id integer,
type_id integer DEFAULT 0 NOT NULL
);
--
-- Name: theme_modifier_sets; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.theme_modifier_sets (
id bigint NOT NULL,
theme_id bigint NOT NULL,
serialize_topic_excerpts boolean,
csp_extensions character varying[],
svg_icons character varying[],
topic_thumbnail_sizes character varying[]
);
--
-- Name: theme_settings; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.theme_settings (
id bigint NOT NULL,
name character varying(255) NOT NULL,
data_type integer NOT NULL,
value text,
theme_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: theme_translation_overrides; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.theme_translation_overrides (
id bigint NOT NULL,
theme_id integer NOT NULL,
locale character varying NOT NULL,
translation_key character varying NOT NULL,
value character varying NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: themes; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.themes (
id integer NOT NULL,
name character varying NOT NULL,
user_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
compiler_version integer DEFAULT 0 NOT NULL,
user_selectable boolean DEFAULT false NOT NULL,
hidden boolean DEFAULT false NOT NULL,
color_scheme_id integer,
remote_theme_id integer,
component boolean DEFAULT false NOT NULL,
enabled boolean DEFAULT true NOT NULL,
auto_update boolean DEFAULT true NOT NULL
);
--
-- Name: top_topics; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.top_topics (
id integer NOT NULL,
topic_id integer,
yearly_posts_count integer DEFAULT 0 NOT NULL,
yearly_views_count integer DEFAULT 0 NOT NULL,
yearly_likes_count integer DEFAULT 0 NOT NULL,
monthly_posts_count integer DEFAULT 0 NOT NULL,
monthly_views_count integer DEFAULT 0 NOT NULL,
monthly_likes_count integer DEFAULT 0 NOT NULL,
weekly_posts_count integer DEFAULT 0 NOT NULL,
weekly_views_count integer DEFAULT 0 NOT NULL,
weekly_likes_count integer DEFAULT 0 NOT NULL,
daily_posts_count integer DEFAULT 0 NOT NULL,
daily_views_count integer DEFAULT 0 NOT NULL,
daily_likes_count integer DEFAULT 0 NOT NULL,
daily_score double precision DEFAULT 0.0,
weekly_score double precision DEFAULT 0.0,
monthly_score double precision DEFAULT 0.0,
yearly_score double precision DEFAULT 0.0,
all_score double precision DEFAULT 0.0,
daily_op_likes_count integer DEFAULT 0 NOT NULL,
weekly_op_likes_count integer DEFAULT 0 NOT NULL,
monthly_op_likes_count integer DEFAULT 0 NOT NULL,
yearly_op_likes_count integer DEFAULT 0 NOT NULL,
quarterly_posts_count integer DEFAULT 0 NOT NULL,
quarterly_views_count integer DEFAULT 0 NOT NULL,
quarterly_likes_count integer DEFAULT 0 NOT NULL,
quarterly_score double precision DEFAULT 0.0,
quarterly_op_likes_count integer DEFAULT 0 NOT NULL
);
--
-- Name: topic_allowed_groups; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.topic_allowed_groups (
id integer NOT NULL,
group_id integer NOT NULL,
topic_id integer NOT NULL
);
--
-- Name: topic_allowed_users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.topic_allowed_users (
id integer NOT NULL,
user_id integer NOT NULL,
topic_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: topic_custom_fields; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.topic_custom_fields (
id integer NOT NULL,
topic_id integer NOT NULL,
name character varying(256) NOT NULL,
value text,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: topic_embeds; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.topic_embeds (
id integer NOT NULL,
topic_id integer NOT NULL,
post_id integer NOT NULL,
embed_url character varying(1000) NOT NULL,
content_sha1 character varying(40),
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
deleted_at timestamp without time zone,
deleted_by_id integer
);
--
-- Name: topic_groups; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.topic_groups (
id bigint NOT NULL,
group_id integer NOT NULL,
topic_id integer NOT NULL,
last_read_post_number integer DEFAULT 0 NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: topic_invites; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.topic_invites (
id integer NOT NULL,
topic_id integer NOT NULL,
invite_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: topic_link_clicks; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.topic_link_clicks (
id integer NOT NULL,
topic_link_id integer NOT NULL,
user_id integer,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
ip_address inet
);
--
-- Name: topic_links; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.topic_links (
id integer NOT NULL,
topic_id integer NOT NULL,
post_id integer,
user_id integer NOT NULL,
url character varying NOT NULL,
domain character varying(100) NOT NULL,
internal boolean DEFAULT false NOT NULL,
link_topic_id integer,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
reflection boolean DEFAULT false,
clicks integer DEFAULT 0 NOT NULL,
link_post_id integer,
title character varying,
crawled_at timestamp without time zone,
quote boolean DEFAULT false NOT NULL,
extension character varying(10)
);
--
-- Name: topic_search_data; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.topic_search_data (
topic_id integer NOT NULL,
raw_data text,
locale character varying NOT NULL,
search_data tsvector,
version integer DEFAULT 0
);
--
-- Name: topic_tags; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.topic_tags (
id integer NOT NULL,
topic_id integer NOT NULL,
tag_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: topic_thumbnails; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.topic_thumbnails (
id bigint NOT NULL,
upload_id bigint NOT NULL,
optimized_image_id bigint,
max_width integer NOT NULL,
max_height integer NOT NULL
);
--
-- Name: topic_timers; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.topic_timers (
id integer NOT NULL,
execute_at timestamp without time zone NOT NULL,
status_type integer NOT NULL,
user_id integer NOT NULL,
topic_id integer NOT NULL,
based_on_last_post boolean DEFAULT false NOT NULL,
deleted_at timestamp without time zone,
deleted_by_id integer,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
category_id integer,
public_type boolean DEFAULT true,
duration_minutes integer
);
--
-- Name: topic_users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.topic_users (
user_id integer NOT NULL,
topic_id integer NOT NULL,
posted boolean DEFAULT false NOT NULL,
last_read_post_number integer,
last_visited_at timestamp without time zone,
first_visited_at timestamp without time zone,
notification_level integer DEFAULT 1 NOT NULL,
notifications_changed_at timestamp without time zone,
notifications_reason_id integer,
total_msecs_viewed integer DEFAULT 0 NOT NULL,
cleared_pinned_at timestamp without time zone,
id integer NOT NULL,
last_emailed_post_number integer,
liked boolean DEFAULT false,
bookmarked boolean DEFAULT false,
last_posted_at timestamp without time zone
);
--
-- Name: topic_views; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.topic_views (
topic_id integer NOT NULL,
viewed_at date NOT NULL,
user_id integer,
ip_address inet
);
--
-- Name: translation_overrides; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.translation_overrides (
id integer NOT NULL,
locale character varying NOT NULL,
translation_key character varying NOT NULL,
value character varying NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
compiled_js text
);
--
-- Name: unsubscribe_keys; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.unsubscribe_keys (
key character varying(64) NOT NULL,
user_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
unsubscribe_key_type character varying,
topic_id integer,
post_id integer
);
--
-- Name: uploads; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.uploads (
id integer NOT NULL,
user_id integer NOT NULL,
original_filename character varying NOT NULL,
filesize bigint NOT NULL,
width integer,
height integer,
url character varying NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
sha1 character varying(40),
origin character varying(1000),
retain_hours integer,
extension character varying(10),
thumbnail_width integer,
thumbnail_height integer,
etag character varying,
secure boolean DEFAULT false NOT NULL,
access_control_post_id bigint,
original_sha1 character varying,
verification_status integer DEFAULT 1 NOT NULL,
animated boolean,
security_last_changed_at timestamp without time zone,
security_last_changed_reason character varying
);
--
-- Name: user_actions; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_actions (
id integer NOT NULL,
action_type integer NOT NULL,
user_id integer NOT NULL,
target_topic_id integer,
target_post_id integer,
target_user_id integer,
acting_user_id integer,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: user_api_key_scopes; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_api_key_scopes (
id bigint NOT NULL,
user_api_key_id integer NOT NULL,
name character varying NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL,
allowed_parameters jsonb
);
--
-- Name: user_api_keys; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_api_keys (
id integer NOT NULL,
user_id integer NOT NULL,
client_id character varying NOT NULL,
application_name character varying NOT NULL,
push_url character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
revoked_at timestamp without time zone,
scopes text[],
last_used_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
key_hash character varying NOT NULL
);
--
-- Name: user_archived_messages; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_archived_messages (
id integer NOT NULL,
user_id integer NOT NULL,
topic_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: user_associated_accounts; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_associated_accounts (
id bigint NOT NULL,
provider_name character varying NOT NULL,
provider_uid character varying NOT NULL,
user_id integer,
last_used timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
info jsonb DEFAULT '{}'::jsonb NOT NULL,
credentials jsonb DEFAULT '{}'::jsonb NOT NULL,
extra jsonb DEFAULT '{}'::jsonb NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: user_associated_groups; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_associated_groups (
id bigint NOT NULL,
user_id bigint NOT NULL,
associated_group_id bigint NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: user_auth_token_logs; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_auth_token_logs (
id integer NOT NULL,
action character varying NOT NULL,
user_auth_token_id integer,
user_id integer,
client_ip inet,
user_agent character varying,
auth_token character varying,
created_at timestamp without time zone,
path character varying
);
--
-- Name: user_auth_tokens; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_auth_tokens (
id integer NOT NULL,
user_id integer NOT NULL,
auth_token character varying NOT NULL,
prev_auth_token character varying NOT NULL,
user_agent character varying,
auth_token_seen boolean DEFAULT false NOT NULL,
client_ip inet,
rotated_at timestamp without time zone NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
seen_at timestamp without time zone
);
--
-- Name: user_avatars; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_avatars (
id integer NOT NULL,
user_id integer NOT NULL,
custom_upload_id integer,
gravatar_upload_id integer,
last_gravatar_download_attempt timestamp without time zone,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: user_badges; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_badges (
id integer NOT NULL,
badge_id integer NOT NULL,
user_id integer NOT NULL,
granted_at timestamp without time zone NOT NULL,
granted_by_id integer NOT NULL,
post_id integer,
notification_id integer,
seq integer DEFAULT 0 NOT NULL,
featured_rank integer,
created_at timestamp without time zone NOT NULL,
is_favorite boolean
);
--
-- Name: user_custom_fields; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_custom_fields (
id integer NOT NULL,
user_id integer NOT NULL,
name character varying(256) NOT NULL,
value text,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: user_emails; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_emails (
id integer NOT NULL,
user_id integer NOT NULL,
email character varying(513) NOT NULL,
"primary" boolean DEFAULT false NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
normalized_email character varying
);
--
-- Name: user_exports; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_exports (
id integer NOT NULL,
file_name character varying NOT NULL,
user_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
upload_id integer,
topic_id integer
);
--
-- Name: user_field_options; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_field_options (
id integer NOT NULL,
user_field_id integer NOT NULL,
value character varying NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: user_fields; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_fields (
id integer NOT NULL,
name character varying NOT NULL,
field_type character varying NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
editable boolean DEFAULT false NOT NULL,
description character varying NOT NULL,
required boolean DEFAULT true NOT NULL,
show_on_profile boolean DEFAULT false NOT NULL,
"position" integer DEFAULT 0,
show_on_user_card boolean DEFAULT false NOT NULL,
external_name character varying,
external_type character varying,
searchable boolean DEFAULT false NOT NULL
);
--
-- Name: user_histories; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_histories (
id integer NOT NULL,
action integer NOT NULL,
acting_user_id integer,
target_user_id integer,
details text,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
context character varying,
ip_address character varying,
email character varying,
subject text,
previous_value text,
new_value text,
topic_id integer,
admin_only boolean DEFAULT false,
post_id integer,
custom_type character varying,
category_id integer
);
--
-- Name: user_ip_address_histories; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_ip_address_histories (
id bigint NOT NULL,
user_id integer NOT NULL,
ip_address inet NOT NULL,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: user_notification_schedules; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_notification_schedules (
id bigint NOT NULL,
user_id integer NOT NULL,
enabled boolean DEFAULT false NOT NULL,
day_0_start_time integer NOT NULL,
day_0_end_time integer NOT NULL,
day_1_start_time integer NOT NULL,
day_1_end_time integer NOT NULL,
day_2_start_time integer NOT NULL,
day_2_end_time integer NOT NULL,
day_3_start_time integer NOT NULL,
day_3_end_time integer NOT NULL,
day_4_start_time integer NOT NULL,
day_4_end_time integer NOT NULL,
day_5_start_time integer NOT NULL,
day_5_end_time integer NOT NULL,
day_6_start_time integer NOT NULL,
day_6_end_time integer NOT NULL
);
--
-- Name: user_open_ids; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_open_ids (
id integer NOT NULL,
user_id integer NOT NULL,
email character varying NOT NULL,
url character varying NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
active boolean NOT NULL
);
--
-- Name: user_options; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_options (
user_id integer NOT NULL,
mailing_list_mode boolean DEFAULT false NOT NULL,
email_digests boolean,
external_links_in_new_tab boolean DEFAULT false NOT NULL,
enable_quoting boolean DEFAULT true NOT NULL,
dynamic_favicon boolean DEFAULT false NOT NULL,
automatically_unpin_topics boolean DEFAULT true NOT NULL,
digest_after_minutes integer,
auto_track_topics_after_msecs integer,
new_topic_duration_minutes integer,
last_redirected_to_top_at timestamp without time zone,
email_previous_replies integer DEFAULT 2 NOT NULL,
email_in_reply_to boolean DEFAULT true NOT NULL,
like_notification_frequency integer DEFAULT 1 NOT NULL,
mailing_list_mode_frequency integer DEFAULT 1 NOT NULL,
include_tl0_in_digests boolean DEFAULT false,
notification_level_when_replying integer,
theme_key_seq integer DEFAULT 0 NOT NULL,
allow_private_messages boolean DEFAULT true NOT NULL,
homepage_id integer,
theme_ids integer[] DEFAULT '{}'::integer[] NOT NULL,
hide_profile_and_presence boolean DEFAULT false NOT NULL,
text_size_key integer DEFAULT 0 NOT NULL,
text_size_seq integer DEFAULT 0 NOT NULL,
email_level integer DEFAULT 1 NOT NULL,
email_messages_level integer DEFAULT 0 NOT NULL,
title_count_mode_key integer DEFAULT 0 NOT NULL,
enable_defer boolean DEFAULT false NOT NULL,
timezone character varying,
enable_allowed_pm_users boolean DEFAULT false NOT NULL,
dark_scheme_id integer,
skip_new_user_tips boolean DEFAULT false NOT NULL,
color_scheme_id integer,
default_calendar integer DEFAULT 0 NOT NULL,
oldest_search_log_date timestamp without time zone,
bookmark_auto_delete_preference integer DEFAULT 3 NOT NULL,
enable_experimental_sidebar boolean DEFAULT false
);
--
-- Name: user_profile_views; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_profile_views (
id integer NOT NULL,
user_profile_id integer NOT NULL,
viewed_at timestamp without time zone NOT NULL,
ip_address inet,
user_id integer
);
--
-- Name: user_profiles; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_profiles (
user_id integer NOT NULL,
location character varying,
website character varying,
bio_raw text,
bio_cooked text,
dismissed_banner_key integer,
bio_cooked_version integer,
badge_granted_title boolean DEFAULT false,
views integer DEFAULT 0 NOT NULL,
profile_background_upload_id integer,
card_background_upload_id integer,
granted_title_badge_id bigint,
featured_topic_id integer
);
--
-- Name: user_search_data; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_search_data (
user_id integer NOT NULL,
search_data tsvector,
raw_data text,
locale text,
version integer DEFAULT 0
);
--
-- Name: user_second_factors; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_second_factors (
id bigint NOT NULL,
user_id integer NOT NULL,
method integer NOT NULL,
data character varying NOT NULL,
enabled boolean DEFAULT false NOT NULL,
last_used timestamp without time zone,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
name character varying
);
--
-- Name: user_security_keys; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_security_keys (
id bigint NOT NULL,
user_id bigint NOT NULL,
credential_id character varying NOT NULL,
public_key character varying NOT NULL,
factor_type integer DEFAULT 0 NOT NULL,
enabled boolean DEFAULT true NOT NULL,
name character varying NOT NULL,
last_used timestamp without time zone,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: user_stats; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_stats (
user_id integer NOT NULL,
topics_entered integer DEFAULT 0 NOT NULL,
time_read integer DEFAULT 0 NOT NULL,
days_visited integer DEFAULT 0 NOT NULL,
posts_read_count integer DEFAULT 0 NOT NULL,
likes_given integer DEFAULT 0 NOT NULL,
likes_received integer DEFAULT 0 NOT NULL,
new_since timestamp without time zone NOT NULL,
read_faq timestamp without time zone,
first_post_created_at timestamp without time zone,
post_count integer DEFAULT 0 NOT NULL,
topic_count integer DEFAULT 0 NOT NULL,
bounce_score double precision DEFAULT 0 NOT NULL,
reset_bounce_score_after timestamp without time zone,
flags_agreed integer DEFAULT 0 NOT NULL,
flags_disagreed integer DEFAULT 0 NOT NULL,
flags_ignored integer DEFAULT 0 NOT NULL,
first_unread_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
distinct_badge_count integer DEFAULT 0 NOT NULL,
first_unread_pm_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
digest_attempted_at timestamp without time zone,
draft_count integer DEFAULT 0 NOT NULL,
post_edits_count integer,
pending_posts_count integer DEFAULT 0 NOT NULL
);
--
-- Name: user_statuses; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_statuses (
user_id integer NOT NULL,
emoji character varying,
description character varying NOT NULL,
set_at timestamp(6) without time zone NOT NULL,
ends_at timestamp(6) without time zone
);
--
-- Name: user_uploads; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_uploads (
id bigint NOT NULL,
upload_id integer NOT NULL,
user_id integer NOT NULL,
created_at timestamp without time zone NOT NULL
);
--
-- Name: user_visits; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_visits (
id integer NOT NULL,
user_id integer NOT NULL,
visited_at date NOT NULL,
posts_read integer DEFAULT 0,
mobile boolean DEFAULT false,
time_read integer DEFAULT 0 NOT NULL
);
--
-- Name: user_warnings; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.user_warnings (
id integer NOT NULL,
topic_id integer NOT NULL,
user_id integer NOT NULL,
created_by_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.users (
id integer NOT NULL,
username character varying(60) NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
name character varying,
seen_notification_id integer DEFAULT 0 NOT NULL,
last_posted_at timestamp without time zone,
password_hash character varying(64),
salt character varying(32),
active boolean DEFAULT false NOT NULL,
username_lower character varying(60) NOT NULL,
last_seen_at timestamp without time zone,
admin boolean DEFAULT false NOT NULL,
last_emailed_at timestamp without time zone,
trust_level integer NOT NULL,
approved boolean DEFAULT false NOT NULL,
approved_by_id integer,
approved_at timestamp without time zone,
previous_visit_at timestamp without time zone,
suspended_at timestamp without time zone,
suspended_till timestamp without time zone,
date_of_birth date,
views integer DEFAULT 0 NOT NULL,
flag_level integer DEFAULT 0 NOT NULL,
ip_address inet,
moderator boolean DEFAULT false,
title character varying,
uploaded_avatar_id integer,
locale character varying(10),
primary_group_id integer,
registration_ip_address inet,
staged boolean DEFAULT false NOT NULL,
first_seen_at timestamp without time zone,
silenced_till timestamp without time zone,
group_locked_trust_level integer,
manual_locked_trust_level integer,
secure_identifier character varying,
flair_group_id integer,
last_seen_reviewable_id integer
);
--
-- Name: watched_words; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.watched_words (
id integer NOT NULL,
word character varying NOT NULL,
action integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
replacement character varying
);
--
-- Name: web_crawler_requests; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.web_crawler_requests (
id bigint NOT NULL,
date date NOT NULL,
user_agent character varying NOT NULL,
count integer DEFAULT 0 NOT NULL
);
--
-- Name: web_hook_event_types; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.web_hook_event_types (
id integer NOT NULL,
name character varying NOT NULL
);
--
-- Name: web_hook_event_types_hooks; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.web_hook_event_types_hooks (
web_hook_id integer NOT NULL,
web_hook_event_type_id integer NOT NULL
);
--
-- Name: web_hook_events; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.web_hook_events (
id integer NOT NULL,
web_hook_id integer NOT NULL,
headers character varying,
payload text,
status integer DEFAULT 0,
response_headers character varying,
response_body text,
duration integer DEFAULT 0,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: web_hooks; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.web_hooks (
id integer NOT NULL,
payload_url character varying NOT NULL,
content_type integer DEFAULT 1 NOT NULL,
last_delivery_status integer DEFAULT 1 NOT NULL,
status integer DEFAULT 1 NOT NULL,
secret character varying DEFAULT ''::character varying,
wildcard_web_hook boolean DEFAULT false NOT NULL,
verify_certificate boolean DEFAULT true NOT NULL,
active boolean DEFAULT false NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment