You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lemmy/migrations/2023-02-11-173347_custom_em.../up.sql

21 lines
697 B
SQL

CREATE TABLE custom_emoji (
id serial PRIMARY KEY,
local_site_id int REFERENCES local_site ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
shortcode varchar(128) NOT NULL UNIQUE,
image_url text NOT NULL UNIQUE,
alt_text text NOT NULL,
category text NOT NULL,
published timestamp without time zone DEFAULT now() NOT NULL,
updated timestamp without time zone
);
CREATE TABLE custom_emoji_keyword (
id serial PRIMARY KEY,
custom_emoji_id int REFERENCES custom_emoji ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
keyword varchar(128) NOT NULL,
UNIQUE (custom_emoji_id, keyword)
);
CREATE INDEX idx_custom_emoji_category ON custom_emoji (id, category);