mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 00:51:12 -05:00
Fix: Remove versioning helpers
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
-- Archive old JSONB versions table before dropping
|
||||
-- This preserves historical data while allowing us to move forward
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.entity_versions_archive (
|
||||
LIKE public.entity_versions INCLUDING ALL
|
||||
);
|
||||
|
||||
-- Copy all old versions to archive
|
||||
INSERT INTO public.entity_versions_archive
|
||||
SELECT * FROM public.entity_versions
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
-- Verify counts match
|
||||
DO $$
|
||||
DECLARE
|
||||
original_count INTEGER;
|
||||
archive_count INTEGER;
|
||||
BEGIN
|
||||
SELECT COUNT(*) INTO original_count FROM public.entity_versions;
|
||||
SELECT COUNT(*) INTO archive_count FROM public.entity_versions_archive;
|
||||
|
||||
IF original_count != archive_count THEN
|
||||
RAISE EXCEPTION 'Archive verification failed: original=%, archive=%', original_count, archive_count;
|
||||
END IF;
|
||||
|
||||
RAISE NOTICE 'Successfully archived % versions to entity_versions_archive', archive_count;
|
||||
END $$;
|
||||
Reference in New Issue
Block a user