lemmy/migrations/2021-02-25-112959_remove-categories/down.sql
Dull Bananas 5d8af0d476 fix
2024-05-17 20:21:13 +00:00

38 lines
814 B
SQL

CREATE TABLE category (
id serial PRIMARY KEY,
name varchar(100) NOT NULL UNIQUE
);
INSERT INTO category (name)
VALUES ('Discussion'),
('Humor/Memes'),
('Gaming'),
('Movies'),
('TV'),
('Music'),
('Literature'),
('Comics'),
('Photography'),
('Art'),
('Learning'),
('DIY'),
('Lifestyle'),
('News'),
('Politics'),
('Society'),
('Gender/Identity/Sexuality'),
('Race/Colonisation'),
('Religion'),
('Science/Technology'),
('Programming/Software'),
('Health/Sports/Fitness'),
('Porn'),
('Places'),
('Meta'),
('Other');
ALTER TABLE community
ADD category_id int REFERENCES category ON UPDATE CASCADE ON DELETE CASCADE NOT NULL DEFAULT 1;
CREATE INDEX idx_community_category ON community (category_id);