]> Untitled Git - lemmy.git/blob - migrations/2023-02-11-173347_custom_emojis/up.sql
add enable_federated_downvotes site option
[lemmy.git] / migrations / 2023-02-11-173347_custom_emojis / up.sql
1 CREATE TABLE custom_emoji (
2     id serial PRIMARY KEY,
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
10 );
11
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)
17 );
18
19 CREATE INDEX idx_custom_emoji_category ON custom_emoji (id, category);
20