-- One-off bridge from the pre-foundation site schema to the current table names. -- Run after the Animaldex UUID conversion, if needed, and before the auth, -- foundation, and catalog migrations. Review and back up each database first. -- Renaming keeps existing rows and foreign keys; lists did not exist in this schema. BEGIN; ALTER TABLE public.game RENAME TO games; ALTER TABLE public.pokemon_game_entry RENAME TO pokemon_game_entries; ALTER TABLE public.user_entry RENAME TO user_entries; ALTER TABLE public.user_game RENAME TO user_games; CREATE TABLE public.lists ( id serial PRIMARY KEY, name text NOT NULL ); CREATE TABLE public.list_items ( id serial PRIMARY KEY, list_id integer NOT NULL REFERENCES public.lists(id) ON DELETE CASCADE, name text NOT NULL ); CREATE INDEX list_items_list_id_idx ON public.list_items(list_id); COMMIT;