diff options
author | Vincent Ambo <tazjin@gmail.com> | 2018-05-01T18·23+0200 |
---|---|---|
committer | Vincent Ambo <github@tazj.in> | 2018-05-01T22·33+0200 |
commit | a45da31abc09b5199d2aaefc038b8c59e0c50975 (patch) | |
tree | ffe6506882c8bbac341eaecba4c9654761efaa9a /migrations/2018-05-01-141548_add-users/down.sql | |
parent | a324a89fd089ca489e6120ed6ee6b394750cacb6 (diff) |
refactor(migrations): Rename 'author' column to 'user_id'
This makes it easier to integrate with Diesel, for which this is the expected column name.
Diffstat (limited to 'migrations/2018-05-01-141548_add-users/down.sql')
-rw-r--r-- | migrations/2018-05-01-141548_add-users/down.sql | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/migrations/2018-05-01-141548_add-users/down.sql b/migrations/2018-05-01-141548_add-users/down.sql index 2f903171d4ba..61fd222e18cf 100644 --- a/migrations/2018-05-01-141548_add-users/down.sql +++ b/migrations/2018-05-01-141548_add-users/down.sql @@ -8,12 +8,12 @@ ALTER TABLE posts ADD COLUMN author_email VARCHAR; UPDATE threads SET author_name = users.name, author_email = users.email FROM users - WHERE threads.author = users.id; + WHERE threads.user_id = users.id; UPDATE posts SET author_name = users.name, author_email = users.email FROM users - WHERE posts.author = users.id; + WHERE posts.user_id = users.id; -- add the constraints back: ALTER TABLE threads ALTER COLUMN author_name SET NOT NULL; @@ -58,6 +58,6 @@ CREATE MATERIALIZED VIEW search_index AS CREATE INDEX idx_fts_search ON search_index USING gin(document); -- and drop the users table and columns: -ALTER TABLE posts DROP COLUMN author; -ALTER TABLE threads DROP COLUMN author; +ALTER TABLE posts DROP COLUMN user_id; +ALTER TABLE threads DROP COLUMN user_id; DROP TABLE users; |