mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-10-01 01:36:12 -04:00
Drop and re-add columns instead.
This commit is contained in:
parent
89d5627963
commit
6efd025470
@ -1,6 +1,10 @@
|
||||
ALTER TABLE local_user_vote_display_mode
|
||||
ALTER COLUMN upvotes SET DEFAULT FALSE,
|
||||
ALTER COLUMN downvotes SET DEFAULT FALSE,
|
||||
ALTER COLUMN score SET DEFAULT TRUE,
|
||||
ALTER COLUMN upvote_percentage SET DEFAULT TRUE;
|
||||
DROP COLUMN score,
|
||||
ADD COLUMN score boolean DEFAULT TRUE NOT NULL,
|
||||
DROP COLUMN upvotes,
|
||||
ADD COLUMN upvotes boolean DEFAULT FALSE NOT NULL,
|
||||
DROP COLUMN downvotes,
|
||||
ADD COLUMN downvotes boolean DEFAULT FALSE NOT NULL,
|
||||
DROP COLUMN upvote_percentage,
|
||||
ADD COLUMN upvote_percentage boolean DEFAULT TRUE NOT NULL;
|
||||
|
||||
|
@ -3,18 +3,12 @@
|
||||
-- Rather than
|
||||
-- Score + upvote_percentage
|
||||
ALTER TABLE local_user_vote_display_mode
|
||||
ALTER COLUMN upvotes SET DEFAULT TRUE,
|
||||
ALTER COLUMN downvotes SET DEFAULT TRUE,
|
||||
ALTER COLUMN score SET DEFAULT FALSE,
|
||||
ALTER COLUMN upvote_percentage SET DEFAULT FALSE;
|
||||
|
||||
-- Regenerate the rows with the new default
|
||||
DELETE FROM local_user_vote_display_mode;
|
||||
|
||||
-- Re-insert them
|
||||
INSERT INTO local_user_vote_display_mode (local_user_id)
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
local_user;
|
||||
DROP COLUMN score,
|
||||
ADD COLUMN score boolean DEFAULT FALSE NOT NULL,
|
||||
DROP COLUMN upvotes,
|
||||
ADD COLUMN upvotes boolean DEFAULT TRUE NOT NULL,
|
||||
DROP COLUMN downvotes,
|
||||
ADD COLUMN downvotes boolean DEFAULT TRUE NOT NULL,
|
||||
DROP COLUMN upvote_percentage,
|
||||
ADD COLUMN upvote_percentage boolean DEFAULT FALSE NOT NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user