lemmy/migrations/2024-10-17-091053_vote-no-timestamp/up.sql

28 lines
614 B
MySQL
Raw Normal View History

2024-10-17 13:08:56 +00:00
-- make published columns nullable and remove default value
2024-10-17 12:22:36 +00:00
ALTER TABLE post_like
ALTER COLUMN published DROP NOT NULL;
2024-10-17 13:08:56 +00:00
ALTER TABLE post_like
ALTER COLUMN published DROP DEFAULT;
2024-10-17 12:22:36 +00:00
ALTER TABLE comment_like
ALTER COLUMN published DROP NOT NULL;
2024-10-17 13:08:56 +00:00
ALTER TABLE comment_like
ALTER COLUMN published DROP DEFAULT;
2024-10-17 12:22:36 +00:00
2024-10-17 13:08:56 +00:00
-- get rid of comment_like.post_id, setting null first to reclaim space
-- https://dba.stackexchange.com/a/117513
2024-10-17 12:22:36 +00:00
ALTER TABLE comment_like
ALTER COLUMN post_id DROP NOT NULL;
UPDATE
post_like
SET
post_id = NULL;
-- drop the columns
2024-10-17 09:45:58 +00:00
ALTER TABLE comment_like
DROP post_id;
2024-10-17 09:23:16 +00:00