mirror of
https://github.com/discourse/discourse.git
synced 2024-12-21 11:13:44 +08:00
93264da206
This will be used by migration scripts.
481 lines
12 KiB
YAML
481 lines
12 KiB
YAML
## Configuration options for the base intermediate schema generator
|
|
##
|
|
## After modifying this file, regenerate the base intermediate schema
|
|
## by running the `generate_schema` script.
|
|
|
|
# Default relative path for generated base schema file.
|
|
# An absolute path can also be provided to the script as the first CLI argument.
|
|
# If the CLI argument is present, it takes precedence over the value specified here.
|
|
output_file_path: ../common/intermediate_db_schema/000_base_schema.sql
|
|
|
|
## Tables to include in the generated base intermediate schema.
|
|
##
|
|
## Available table options:
|
|
## virtual: Boolean. Enables the inclusion of a table in the schema solely based.
|
|
## on the provided configuration. A virtual table does not need to be available in the core schema.
|
|
## ignore: List of columns to ignore. Convenient if most of the table's column are needed.
|
|
## Usage is mutually exclusive with the `include` option. Only one should be used at a time.
|
|
## include: List of columns to include. Convenient if only a few columns are needed.
|
|
## Usage is mutually exclusive with the `include`` option. Only one should be used at a time.
|
|
## primary_key: Literal or list of columns to use as primary key.
|
|
## extend: List of objects describing columns to be added/extended.
|
|
## The following options are available for an "extend" object:
|
|
## name: Required. The name of the column being extended.
|
|
## is_null: Specifies if the column can be null.
|
|
## type: Column type. Defaults to TEXT.
|
|
## indexes: List of indexes to create. The following options are available for an "index" object:
|
|
## name: Index name.
|
|
## columns: List of column(s) to index.
|
|
tables:
|
|
schema_migrations:
|
|
virtual: true
|
|
primary_key: path
|
|
extend:
|
|
- name: path
|
|
is_null: false
|
|
- name: created_at
|
|
type: datetime
|
|
config:
|
|
virtual: true
|
|
primary_key: name
|
|
extend:
|
|
- name: name
|
|
is_null: false
|
|
- name: value
|
|
is_null: false
|
|
log_entries:
|
|
virtual: true
|
|
extend:
|
|
- name: created_at
|
|
type: datetime
|
|
is_null: false
|
|
- name: type
|
|
is_null: false
|
|
- name: message
|
|
is_null: false
|
|
- name: exception
|
|
- name: details
|
|
users:
|
|
ignore:
|
|
- seen_notification_id
|
|
- last_posted_at
|
|
- password_hash
|
|
- salt
|
|
- active
|
|
- last_emailed_at
|
|
- approved_by_id
|
|
- previous_visit_at
|
|
- suspended_at
|
|
- suspended_till
|
|
- views
|
|
- flag_level
|
|
- ip_address
|
|
- title
|
|
- uploaded_avatar_id
|
|
- locale
|
|
- primary_group_id
|
|
- first_seen_at
|
|
- silenced_till
|
|
- group_locked_trust_level
|
|
- manual_locked_trust_level
|
|
- secure_identifier
|
|
- flair_group_id
|
|
- last_seen_reviewable_id
|
|
- password_algorithm
|
|
- username_lower
|
|
extend:
|
|
- name: email
|
|
- name: created_at
|
|
is_null: true
|
|
- name: staged
|
|
is_null: true
|
|
- name: avatar_path
|
|
- name: avatar_url
|
|
- name: avatar_upload_id
|
|
- name: bio
|
|
- name: password
|
|
is_null: true
|
|
- name: trust_level
|
|
is_null: true
|
|
- name: suspension
|
|
- name: location
|
|
- name: website
|
|
- name: old_relative_url
|
|
- name: sso_record
|
|
- name: anonymized
|
|
type: boolean
|
|
- name: original_username
|
|
- name: timezone
|
|
- name: email_level
|
|
type: integer
|
|
- name: email_messages_level
|
|
type: integer
|
|
- name: email_digests
|
|
type: boolean
|
|
categories:
|
|
ignore:
|
|
- topic_id
|
|
- topic_count
|
|
- user_id
|
|
- topics_year
|
|
- topics_month
|
|
- topics_week
|
|
- auto_close_hours
|
|
- post_count
|
|
- latest_post_id
|
|
- latest_topic_id
|
|
- posts_year
|
|
- posts_month
|
|
- posts_week
|
|
- email_in
|
|
- email_in_allow_strangers
|
|
- topics_day
|
|
- posts_day
|
|
- allow_badges
|
|
- name_lower
|
|
- auto_close_based_on_last_post
|
|
- topic_template
|
|
- contains_messages
|
|
- sort_order
|
|
- sort_ascending
|
|
- uploaded_logo_id
|
|
- uploaded_background_id
|
|
- topic_featured_link_allowed
|
|
- all_topics_wiki
|
|
- show_subcategory_list
|
|
- num_featured_topics
|
|
- default_view
|
|
- subcategory_list_style
|
|
- default_top_period
|
|
- mailinglist_mirror
|
|
- minimum_required_tags
|
|
- navigate_to_first_post_after_read
|
|
- search_priority
|
|
- allow_global_tags
|
|
- reviewable_by_group_id
|
|
- read_only_banner
|
|
- default_list_filter
|
|
- allow_unlimited_owner_edits_on_first_post
|
|
- default_slow_mode_seconds
|
|
- uploaded_logo_dark_id
|
|
- uploaded_background_dark_id
|
|
extend:
|
|
- name: about_topic_title
|
|
- name: old_relative_url
|
|
- name: existing_id
|
|
type: integer
|
|
- name: permissions
|
|
type: json_text # JSON_TEXT ???
|
|
- name: logo_upload_id
|
|
- name: tag_group_ids
|
|
type: json_text # JSON_TEXT ???
|
|
topics:
|
|
ignore:
|
|
- last_posted_at
|
|
- posts_count
|
|
- last_post_user_id
|
|
- reply_count
|
|
- featured_user1_id
|
|
- featured_user2_id
|
|
- featured_user3_id
|
|
- featured_user4_id
|
|
- deleted_at
|
|
- highest_post_number
|
|
- like_count
|
|
- incoming_link_count
|
|
- moderator_posts_count
|
|
- bumped_at
|
|
- has_summary
|
|
- archetype
|
|
- notify_moderators_count
|
|
- spam_count
|
|
- score
|
|
- percent_rank
|
|
- slug
|
|
- deleted_by_id
|
|
- participant_count
|
|
- word_count
|
|
- excerpt
|
|
- fancy_title
|
|
- highest_staff_post_number
|
|
- featured_link
|
|
- reviewable_score
|
|
- image_upload_id
|
|
- slow_mode_seconds
|
|
- bannered_until
|
|
- external_id
|
|
extend:
|
|
- name: old_relative_url
|
|
- name: private_message
|
|
posts:
|
|
ignore:
|
|
- cooked
|
|
- reply_to_post_number
|
|
- reply_count
|
|
- quote_count
|
|
- deleted_at
|
|
- off_topic_count
|
|
- incoming_link_count
|
|
- bookmark_count
|
|
- score
|
|
- reads
|
|
- post_type
|
|
- sort_order
|
|
- last_editor_id
|
|
- hidden
|
|
- hidden_reason_id
|
|
- notify_moderators_count
|
|
- spam_count
|
|
- illegal_count
|
|
- inappropriate_count
|
|
- last_version_at
|
|
- user_deleted
|
|
- reply_to_user_id
|
|
- percent_rank
|
|
- notify_user_count
|
|
- like_score
|
|
- deleted_by_id
|
|
- edit_reason
|
|
- word_count
|
|
- version
|
|
- cook_method
|
|
- wiki
|
|
- baked_at
|
|
- baked_version
|
|
- hidden_at
|
|
- self_edits
|
|
- reply_quoted
|
|
- via_email
|
|
- raw_email
|
|
- public_version
|
|
- action_code
|
|
- locked_by_id
|
|
- image_upload_id
|
|
- outbound_message_id
|
|
- qa_vote_count # TODO: added from plugin, maybe skip these automatically for core schema?
|
|
extend:
|
|
- name: reply_to_post_id # NOTE: should this be text??
|
|
- name: original_raw
|
|
- name: upload_ids
|
|
type: json_text
|
|
- name: post_number
|
|
type: integer
|
|
- name: old_relative_url
|
|
- name: accepted_answer
|
|
type: boolean
|
|
- name: small_action
|
|
- name: whisper
|
|
type: boolean
|
|
- name: placeholders
|
|
type: json_text
|
|
indexes:
|
|
- name: posts_by_topic_post_number
|
|
columns: [topic_id, post_number]
|
|
uploads:
|
|
ignore:
|
|
- original_filename
|
|
- filesize
|
|
- width
|
|
- height
|
|
- url
|
|
- created_at
|
|
- sha1
|
|
- origin
|
|
- retain_hours
|
|
- extension
|
|
- thumbnail_width
|
|
- thumbnail_height
|
|
- etag
|
|
- secure
|
|
- access_control_post_id
|
|
- original_sha1
|
|
- animated
|
|
- verification_status
|
|
- security_last_changed_at
|
|
- security_last_changed_reason
|
|
- dominant_color
|
|
extend:
|
|
- name: filename
|
|
is_null: false
|
|
- name: relative_path
|
|
- name: type
|
|
- name: data
|
|
type: blob
|
|
groups:
|
|
include:
|
|
- id
|
|
- name
|
|
- full_name
|
|
- visibility_level
|
|
- members_visibility_level
|
|
- mentionable_level
|
|
- messageable_level
|
|
extend:
|
|
- name: description
|
|
group_members:
|
|
virtual: true
|
|
primary_key: [group_id, user_id]
|
|
extend:
|
|
- name: group_id
|
|
type: integer
|
|
- name: user_id
|
|
type: integer
|
|
- name: owner
|
|
type: boolean
|
|
likes:
|
|
virtual: true
|
|
primary_key: [user_id, post_id]
|
|
extend:
|
|
- name: post_id
|
|
type: integer
|
|
is_null: false
|
|
- name: user_id
|
|
type: integer
|
|
is_null: false
|
|
- name: created_at
|
|
type: datetime
|
|
is_null: false
|
|
# TODO: Pending default values & auto incrementing id column
|
|
user_fields:
|
|
ignore:
|
|
- created_at
|
|
- external_name
|
|
- external_type
|
|
extend:
|
|
- name: options
|
|
type: json_text
|
|
muted_users:
|
|
primary_key: [user_id, muted_user_id]
|
|
ignore:
|
|
- id
|
|
- created_at
|
|
# NOTE: Perhaps use core's user_field_options instead?
|
|
user_field_values:
|
|
virtual: true
|
|
extend:
|
|
- name: user_id
|
|
type: integer
|
|
is_null: false
|
|
- name: field_id
|
|
type: integer
|
|
is_null: false
|
|
- name: is_multiselect_field
|
|
type: boolean
|
|
is_null: false
|
|
- name: value
|
|
indexes:
|
|
- name: user_field_values_multiselect
|
|
columns: [user_id, field_id, value]
|
|
unique: true
|
|
condition: WHERE is_multiselect_field = TRUE
|
|
- name: user_field_values_not_multiselect
|
|
columns: [user_id, field_id]
|
|
unique: true
|
|
condition: WHERE is_multiselect_field = FALSE
|
|
tags:
|
|
include:
|
|
- id
|
|
- name
|
|
extend:
|
|
- name: tag_group_id
|
|
type: integer
|
|
tag_groups:
|
|
include:
|
|
- id
|
|
- name
|
|
topic_tags:
|
|
primary_key: [topic_id, tag_id]
|
|
ignore:
|
|
- id
|
|
- created_at
|
|
tag_users:
|
|
primary_key: [tag_id, user_id]
|
|
ignore:
|
|
- id
|
|
- created_at
|
|
badges:
|
|
ignore:
|
|
- grant_count
|
|
- allow_title
|
|
- icon
|
|
- listable
|
|
- target_posts
|
|
- enabled
|
|
- auto_revoke
|
|
- trigger
|
|
- show_posts
|
|
- system
|
|
- image
|
|
- badge_grouping_id
|
|
extend:
|
|
- name: bage_group
|
|
user_badges:
|
|
include:
|
|
- user_id
|
|
- badge_id
|
|
- granted_at
|
|
topic_users:
|
|
primary_key: [user_id, topic_id]
|
|
ignore:
|
|
- id
|
|
- posted
|
|
- cleared_pinned_at
|
|
- last_emailed_post_number
|
|
- liked
|
|
- bookmarked
|
|
- last_posted_at
|
|
permalink_normalizations:
|
|
virtual: true
|
|
primary_key: normalization
|
|
extend:
|
|
- name: normalization
|
|
is_null: false
|
|
site_settings:
|
|
include:
|
|
- name
|
|
- value
|
|
extend:
|
|
- name: action
|
|
category_custom_fields:
|
|
primary_key: [category_id, name]
|
|
ignore:
|
|
- id
|
|
- created_at
|
|
post_custom_fields:
|
|
primary_key: [post_id, name]
|
|
ignore:
|
|
- id
|
|
- created_at
|
|
polls: {}
|
|
poll_options:
|
|
ignore:
|
|
- digest
|
|
- html
|
|
- anonymous_votes
|
|
extend:
|
|
- name: poll_id
|
|
is_null: false
|
|
- name: text
|
|
is_null: false
|
|
- name: position
|
|
type: integer
|
|
- name: created_at
|
|
is_null: true
|
|
poll_votes:
|
|
primary_key: [poll_option_id, user_id]
|
|
ignore: [poll_id]
|
|
extend:
|
|
- name: created_at
|
|
is_null: true
|
|
- name: poll_option_id
|
|
is_null: false
|
|
- name: user_id
|
|
is_null: false
|
|
## Schema-wide column configuration options. These options apply to all tables.
|
|
## See table specific column configuration options above.
|
|
##
|
|
## Available Options:
|
|
## ignore: List of core/plugin table columns to ignore and exclude from intermediate schema.
|
|
columns:
|
|
ignore:
|
|
- updated_at |