For differing PostgreSQL schemas outside of schema public, the hardcoded Postgres metadata for schema public does not work, and creates a TypeScript type error.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
Install Supabase v1.144.7 in a TypeScript repository.
Create a PostgreSQL schema:
--- Create a new schema named `openai`.
CREATE SCHEMA openai;
--- Set the search path to include the new schema.
SET
search_path TO openai,
public;
-- Grant privileges to all tables for various Supabase roles so that the
-- Supabase client instantiated with the public Supabase access token can fetch
-- data, and RLS policies are still enforced per user.
GRANT USAGE ON SCHEMA openai TO postgres,
anon,
authenticated,
service_role,
dashboard_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA openai
GRANT ALL ON TABLES TO postgres,
anon,
authenticated,
service_role,
dashboard_user;
COMMENT ON SCHEMA openai IS 'Schema for storing third-party API calls with OpenAI. This is important for e.g. archiving full conversation messages with OpenAI, which does not have an interface for exporting this information yet since the assistants functionality came out in beta a few days ago as of 11/08/2023.'
Start Supabase using npx supabase start
Reset the Supabase database using npx supabase db reset
Generate the TypeScript types using command or similar: npx supabase gen types typescript --local --schema openai > src/types/supabase-schema-openai-types.ts
Expected behavior
A TypeScript file describing all of the tables, enums, and otherwise TypeScript-migrated models that I can use in a TypeScript project.
Described issue to Supabase support and they confirmed it's an issue with the metadata. Happy to take a shot at updating this and learning to become a contributor.
Bug report
Describe the bug
For differing PostgreSQL schemas outside of schema
public
, the hardcoded Postgres metadata for schemapublic
does not work, and creates a TypeScript type error.To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
npx supabase start
npx supabase db reset
npx supabase gen types typescript --local --schema openai > src/types/supabase-schema-openai-types.ts
Expected behavior
A TypeScript file describing all of the tables, enums, and otherwise TypeScript-migrated models that I can use in a TypeScript project.
However, instead I am receiving this result:
Screenshots
N/A
System information
Additional context
Described issue to Supabase support and they confirmed it's an issue with the metadata. Happy to take a shot at updating this and learning to become a contributor.