Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for database types on different schemas. #392

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dts
Copy link

@dts dts commented Jul 18, 2024

This plumbs through a config-set schema name to the types system.

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

Currently, types do not correctly reflect overridden schemas. This PR allows that schema to be plumbed through reasonably.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes (if not applicable, please state why)
    Not sure what tests apply here.

Copy link

netlify bot commented Jul 18, 2024

👷 Deploy request for n3-supabase pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit b6e0bea

@IsraelOrtuno
Copy link
Contributor

There's a problem with this at the moment as it seems that the types imports (here) in the composables are being wiped out when running the build command:

dist/runtime/composables/useSupabaseClient.d.ts

import type { SupabaseClient } from '@supabase/supabase-js';
export declare const useSupabaseClient: <T = unknown, S extends string & keyof T = Schema>() => SupabaseClient<T, S>;

#383 (comment)

For me this only works when running in the playground folder as the build is prepared using --stub, which doesn't remove any import.

If you want to reproduce just run pnpm run build and check dist/runtime/composables/useSupabaseClient.d.ts. You will see that import type { Database, Schema } from '#build/types/supabase-database' will be gone.

I am still figuring out how to fix this.

@larbish
Copy link
Collaborator

larbish commented Aug 29, 2024

@dts @IsraelOrtuno Could you have a check now that #404 has been merged?

@IsraelOrtuno
Copy link
Contributor

This fixed the issues with my PR so I would say it should work now @dts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants