DO $$ BEGIN IF NOT EXISTS ( SELECT 1 FROM information_schema.tables WHERE table_name = 'tenant_oauth_clients' ) THEN RAISE EXCEPTION 'tenant_oauth_clients table does not exist'; END IF; END $$;