0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-11 02:59:07 +08:00
discourse/migrations/tooling/config/schema/intermediate_db/tables/embed_emojis.rb
Gerhard Schlager 4032dc2b05 MT: Rework the embed linkage tables around an embed owner
The post_* linkage tables from #41177 become embed_* tables keyed by
(owner_type, owner_id), because placeholders will also live in user
bios and group/category/badge descriptions later. On top of the rename:

- quotes carry source coordinates (topic id + post number) and links a
  typed target, so the importer can resolve both once the id maps exist
- new hashtag and emoji linkage tables; mention_type, hashtag_type and
  link_target become integer enums and the string MentionType is gone
- EmbedBuffer records for one owner kind, PlaceholderResolver resolves
  and renders per owner and reports unresolved embeds and orphaned
  placeholders
- the posts and custom_emojis tables stay ignored until their
  conversion steps land in a follow-up PR
- the lazy source-name lookups (users, groups, categories with their
  slug paths, synonym-folded tags) live in their own NameResolver, and
  the resolver spec is split by phase under placeholder_resolver/
2026-07-22 12:56:54 +02:00

20 lines
860 B
Ruby
Vendored

# frozen_string_literal: true
# Custom emoji embeds (`:name:`). Only the source's custom emoji become embeds;
# standard `:smile:` shortcodes stay plain text. A custom emoji is keyed by name,
# and the name is exactly what a conflict renames at import, so there's nothing to
# resolve ahead of time — `name` is the source shortcode (without the surrounding
# colons) and the importer rewrites it through the emoji-name map.
#
# `placeholder` holds the token spliced into the owner's markdown; `owner_type`/
# `owner_id` name that owning record.
Migrations::Tooling::Schema.table :embed_emojis do
synthetic!
add_column :owner_type, :integer, required: true, enum: :embed_owner
add_column :owner_id, :numeric, required: true
add_column :placeholder, :text, required: true
add_column :name, :text, required: true
index :owner_type, :owner_id
end