Files
database/migrations/archive/000.017.sql
T
Rikard BartholfandGitHub ddcbd0afb0 Archive old migrations (#426)
* Archive old migrations

* Fix invalid placement of migrations
2024-10-17 11:19:12 +02:00

39 lines
1.1 KiB
SQL

CREATE TABLE IF NOT EXISTS categorydatakeys
(
id serial NOT NULL,
name character varying(255) NOT NULL,
CONSTRAINT categorydatakeys_pkey
PRIMARY KEY (id)
);
DROP INDEX IF EXISTS categorydatakeys_value_idx;
CREATE UNIQUE INDEX categorydatakeys_value_idx
ON categorydatakeys (name);
CREATE TABLE IF NOT EXISTS categorydata
(
category_id integer NOT NULL,
datakey_id integer NOT NULL,
locale_id integer NOT NULL,
text text NOT NULL,
CONSTRAINT categorydata_pkey
PRIMARY KEY (category_id, datakey_id, locale_id),
CONSTRAINT categorydata_category_id_fkey
FOREIGN KEY (category_id)
REFERENCES categories (id),
CONSTRAINT categorydata_datakey_id_fkey
FOREIGN KEY (datakey_id)
REFERENCES categorydatakeys (id),
CONSTRAINT categorydata_locale_id_fkey
FOREIGN KEY (locale_id)
REFERENCES locales (id)
);
INSERT INTO categorydatakeys (name)
VALUES ('canvas_pagetitle'),
('canvas_metadesc'),
('wallpaper_pagetitle'),
('wallpaper_metadesc'),
('design_wallpaper_pagetitle'),
('design_wallpaper_metadesc');