Files
spsays-bff/migrations/0015_reshares_are_real_posts.down.sql
T

13 lines
579 B
SQL

-- Reverting this requires materialising the new reshared posts back into
-- the post_reshares + post_reshare_images join model and then dropping
-- the column. Documented but not automated — run manually if a rollback
-- is ever actually needed.
--
-- Step 1: recreate the old tables.
-- Step 2: insert one row per reshare back into post_reshares.
-- Step 3: copy each reshare's post_images back into post_reshare_images.
-- Step 4: delete the materialised reshare rows from `posts`.
-- Step 5: drop the column.
ALTER TABLE posts DROP COLUMN IF EXISTS reshared_from_post_id;