Plume/migrations/postgres/2018-12-08-175515_constraints/down.sql
Baptiste Gelez 61b6ceed92
Add some constraint at database level (#342)
* Add some constraint at database level

Fixes #79 and should fix #201 and #113 as well

* Fix tests

Delete duplicated data before adding constraints (only with Postgres, there is no way to do it with Sqlite with complex constraints like the one we are using)

Remove the constraint on media path

* We don't need to drop the media unique constraint anymore

Because we deleted it
2018-12-09 18:44:26 +01:00

25 lines
1.5 KiB
SQL

-- This file should undo anything in `up.sql`
ALTER TABLE api_tokens DROP CONSTRAINT IF EXISTS api_tokens_unique_value;
ALTER TABLE blog_authors DROP CONSTRAINT IF EXISTS blog_author_unique;
ALTER TABLE blogs DROP CONSTRAINT IF EXISTS blog_unique;
ALTER TABLE blogs DROP CONSTRAINT IF EXISTS blog_unique_ap_url;
ALTER TABLE blogs DROP CONSTRAINT IF EXISTS blog_unique_outbox;
ALTER TABLE blogs DROP CONSTRAINT IF EXISTS blog_unique_inbox;
ALTER TABLE comments DROP CONSTRAINT IF EXISTS comments_unique_ap_url;
ALTER TABLE follows DROP CONSTRAINT IF EXISTS follows_unique_ap_url;
ALTER TABLE instances DROP CONSTRAINT IF EXISTS instance_unique_domain;
ALTER TABLE likes DROP CONSTRAINT IF EXISTS likes_unique;
ALTER TABLE likes DROP CONSTRAINT IF EXISTS likes_unique_ap_url;
ALTER TABLE mentions DROP CONSTRAINT IF EXISTS mentions_unique_ap_url;
ALTER TABLE post_authors DROP CONSTRAINT IF EXISTS post_authors_unique;
ALTER TABLE posts DROP CONSTRAINT IF EXISTS post_unique_slug;
ALTER TABLE posts DROP CONSTRAINT IF EXISTS post_unique_ap_url;
ALTER TABLE reshares DROP CONSTRAINT IF EXISTS reshares_unique;
ALTER TABLE reshares DROP CONSTRAINT IF EXISTS reshares_unique_ap_url;
ALTER TABLE tags DROP CONSTRAINT IF EXISTS tags_unique;
ALTER TABLE users DROP CONSTRAINT IF EXISTS users_unique;
ALTER TABLE users DROP CONSTRAINT IF EXISTS users_unique_inbox;
ALTER TABLE users DROP CONSTRAINT IF EXISTS users_unique_outbox;
ALTER TABLE users DROP CONSTRAINT IF EXISTS users_unique_ap_url;
ALTER TABLE users DROP CONSTRAINT IF EXISTS users_unique_followers_url;