Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"db:backfill-mistral": "tsx ./supabase/backfill-mistral-embeddings.ts",
"db:up": "supabase migration up --local && npm run db:typegen",
"db:dump-schema": "supabase db dump --local --schema public > supabase/schemas/schema.sql && prettier --write supabase/schemas/schema.sql",
"db:split-schema": "tsx supabase/scripts/split-schema.ts",
"db:generate-migration": "supabase db diff --schema public -f",
"mistral:assess-orphans": "tsx supabase/scripts/cleanup-mistral-orphans.ts -- --dry-run",
"mistral:cleanup-orphans": "tsx supabase/scripts/cleanup-mistral-orphans.ts",
Expand Down
22 changes: 21 additions & 1 deletion apps/backend/supabase/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,27 @@ max_client_conn = 100
[db.migrations]
schema_paths = [
"./schemas/00_extensions.sql",
"./schemas/schema.sql",
"./schemas/00_settings.sql",
"./schemas/01_schema.sql",
"./schemas/02_functions.sql",
"./schemas/20_tables/access_group_members.sql",
"./schemas/20_tables/access_groups.sql",
"./schemas/20_tables/allowed_email_domains.sql",
"./schemas/20_tables/allowed_individual_emails.sql",
"./schemas/20_tables/application_admins.sql",
"./schemas/20_tables/chat_messages.sql",
"./schemas/20_tables/chats.sql",
"./schemas/20_tables/document_chunks.sql",
"./schemas/20_tables/document_folders.sql",
"./schemas/20_tables/document_summaries.sql",
"./schemas/20_tables/documents.sql",
"./schemas/20_tables/favorite_documents.sql",
"./schemas/20_tables/maintenance_mode.sql",
"./schemas/20_tables/profiles.sql",
"./schemas/20_tables/user_hidden_default_documents.sql",
"./schemas/30_foreign_keys.sql",
"./schemas/40_policies.sql",
"./schemas/90_orphaned.sql",
]

[realtime]
Expand Down
35 changes: 35 additions & 0 deletions apps/backend/supabase/schemas/00_settings.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
SET
statement_timeout = 0;

SET
lock_timeout = 0;

SET
idle_in_transaction_session_timeout = 0;

SET
client_encoding = 'UTF8';

SET
standard_conforming_strings = ON;

SELECT
pg_catalog.set_config ('search_path', '', FALSE);

SET
check_function_bodies = FALSE;

SET
xmloption = content;

SET
client_min_messages = warning;

SET
row_security = off;

SET
default_tablespace = '';

SET
default_table_access_method = "heap";
49 changes: 49 additions & 0 deletions apps/backend/supabase/schemas/01_schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
CREATE SCHEMA IF NOT EXISTS "public";

ALTER SCHEMA "public" OWNER TO "pg_database_owner";

COMMENT ON SCHEMA "public" IS 'standard public schema';

GRANT USAGE ON SCHEMA "public" TO "postgres";

GRANT USAGE ON SCHEMA "public" TO "anon";

GRANT USAGE ON SCHEMA "public" TO "authenticated";

GRANT USAGE ON SCHEMA "public" TO "service_role";

ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public"
GRANT ALL ON SEQUENCES TO "postgres";

ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public"
GRANT ALL ON SEQUENCES TO "anon";

ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public"
GRANT ALL ON SEQUENCES TO "authenticated";

ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public"
GRANT ALL ON SEQUENCES TO "service_role";

ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public"
GRANT ALL ON FUNCTIONS TO "postgres";

ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public"
GRANT ALL ON FUNCTIONS TO "anon";

ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public"
GRANT ALL ON FUNCTIONS TO "authenticated";

ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public"
GRANT ALL ON FUNCTIONS TO "service_role";

ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public"
GRANT ALL ON TABLES TO "postgres";

ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public"
GRANT ALL ON TABLES TO "anon";

ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public"
GRANT ALL ON TABLES TO "authenticated";

ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public"
GRANT ALL ON TABLES TO "service_role";
Loading