Eric Bower
·
03 Aug 22
20220727_post_change_post_contraints.sql
1CREATE TYPE space AS ENUM ('prose', 'lists', 'pastes', 'imgs');
2
3ALTER TABLE posts ADD COLUMN cur_space space;
4ALTER TABLE posts ADD COLUMN views int DEFAULT 0;
5ALTER TABLE posts DROP CONSTRAINT unique_filename_for_user;
6ALTER TABLE posts ADD CONSTRAINT unique_filename_for_user UNIQUE (user_id, cur_space, filename);
7
8DROP TABLE post_analytics;