chore: full stack stability and migration fixes, plus react UI progress
This commit is contained in:
19
migrations/20260317100000_move_users_to_auth.sql
Normal file
19
migrations/20260317100000_move_users_to_auth.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
-- Move users and refresh_tokens to auth schema for better isolation and consistency
|
||||
CREATE SCHEMA IF NOT EXISTS auth;
|
||||
|
||||
-- Move the tables (safe and idempotent)
|
||||
DO $$
|
||||
BEGIN
|
||||
IF EXISTS (SELECT FROM pg_tables WHERE schemaname = 'public' AND tablename = 'users') THEN
|
||||
ALTER TABLE public.users SET SCHEMA auth;
|
||||
END IF;
|
||||
IF EXISTS (SELECT FROM pg_tables WHERE schemaname = 'public' AND tablename = 'refresh_tokens') THEN
|
||||
ALTER TABLE public.refresh_tokens SET SCHEMA auth;
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
-- Note: Postgres automatically updates foreign key references and indexes
|
||||
-- when a table is moved to a different schema using SET SCHEMA.
|
||||
|
||||
-- However, we might need to update any explicit cross-schema references in the future
|
||||
-- if we were to move to entirely separate databases. For now, they remain in the same DB.
|
||||
Reference in New Issue
Block a user