Skip to content

BUG: Tables type Supabase has issue when schema is custom #3272

@dreamid27

Description

@dreamid27

Describe the bug
I have a database with 3 schemas, public, accounting and payment.

I get strange things when regenerating, a type with a payment schema using this CLI command.

npx supabase gen types typescript --project-id "changeyourprojectid" --schema payments > ./src/common/types/supabase-payments.ts

The CLI runs and generates, but when I want to use the type (Tables<'payments'>), it returns unknown.

I suspect this is because the publicSchema variable is still set to 'public' and that it should depend on the schema being generated.

To Reproduce
Steps to reproduce the behavior:

  1. Create 1 project with custom schema, e.g. payments
  2. Open your project, and run
npx supabase gen types typescript --project-id "changeyourprojectid" --schema payments > ./src/common/types/supabase-payments.ts
  1. supabase will regenerate supabase-payments.ts
  2. Then create a variable with type tables<'payments'>, it will produce unknown type.

Expected behavior

  • Tipenya sesuai dengan yg column yg ada di table.

Screenshots

Image Image Image

System information
Rerun the failing command with --create-ticket flag.

  • Ticket ID: [e.g. ab1ac733e31e4f928a4d7c8402543712]
  • Version of OS: [e.g. Ubuntu 22.04]
  • Version of CLI: [e.g. v1.60.0]
  • Version of Docker: [e.g. v25.0.3]
  • Versions of services: [output from supabase services command]

Additional context
If applicable, add any other context about the problem here.

  • Browser [e.g. chrome, safari]
  • Version of supabase-js [e.g. v2.22.0]
  • Version of Node.js [e.g. v16.20.0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions