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
2 changes: 1 addition & 1 deletion packages/core/supabase-js/src/SupabaseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ export default class SupabaseClient<

this.rest = new PostgrestClient(new URL('rest/v1', baseUrl).href, {
headers: this.headers,
schema: settings.db.schema,
schema: settings.db.schema as any,
fetch: this.fetch,
timeout: settings.db.timeout,
urlLengthLimit: settings.db.urlLengthLimit,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/supabase-js/src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export type SupabaseClientOptions<SchemaName> = {
* The Postgres schema which your tables belong to. Must be on the list of exposed schemas in Supabase. Defaults to `public`.
*/
db?: {
schema?: SchemaName
schema?: string
/**
* Optional timeout in milliseconds for PostgREST requests.
* When set, requests will automatically abort after this duration to prevent indefinite hangs.
Expand Down
9 changes: 9 additions & 0 deletions packages/core/supabase-js/test/unit/SupabaseClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,15 @@ describe('SupabaseClient', () => {
expect(schemaClient).toBeDefined()
expect(schemaClient).toBeInstanceOf(PostgrestClient)
})

test('should initialize client with a custom schema option', () => {
const client = createClient<Database>(URL, KEY, {
db: {
schema: 'personal',
},
})
expect(client).toBeDefined()
})
})

describe('Table/View Queries', () => {
Expand Down