1 CREATE TABLE custom_emoji (
3 local_site_id int REFERENCES local_site ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
4 shortcode varchar(128) NOT NULL UNIQUE,
5 image_url text NOT NULL UNIQUE,
6 alt_text text NOT NULL,
7 category text NOT NULL,
8 published timestamp without time zone DEFAULT now() NOT NULL,
9 updated timestamp without time zone
12 CREATE TABLE custom_emoji_keyword (
13 id serial PRIMARY KEY,
14 custom_emoji_id int REFERENCES custom_emoji ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
15 keyword varchar(128) NOT NULL,
16 UNIQUE (custom_emoji_id, keyword)
19 CREATE INDEX idx_custom_emoji_category ON custom_emoji (id, category);