Supabase [users.id]
I ran
drizzle-kit pull
to get my existing schema from Supabase. The schema output included the following
The issue was with [users.id]
. It said: Cannot find name 'users'.ts(2304). I updated [users.id]
to be [authUsers.id]
. I also imported:
Is that correct fix? The error went away, but this is all new to me.4 Replies
Yes, that's the fix! The pull could be improved, but what you have done is correct.
https://github.com/rphlmr/drizzle-supabase-rls/blob/main/database/schema.ts
This is a big demo of Drizzle with Supabase
GitHub
drizzle-supabase-rls/database/schema.ts at main · rphlmr/drizzle-su...
Contribute to rphlmr/drizzle-supabase-rls development by creating an account on GitHub.
@rphlmr ⚡ Thanks. That fixed the schema.ts file. Another question
The github example repo does not contain a relations.ts file.
In my project the relations.ts contains this:
import { usersInAuth, notifications, notificationChannels, notificationTypeNotificationChannel, notificationTypes, userNotificationPreferences, schoolNotificationInstructions, schools, usersExt, subsTeacherRequests, roles, joinCodes, schoolUserRoles, scheduledNotifications, invites, organizationSettings } from "./schema";
The usersInAuth
has this error: Module '"./schema"' has no exported member 'usersInAuth'.ts(2305)
Two Options To Fix. Which is correct, or is there a better option? I have had a terribly hard time getting the pull and then generate to work
1. I import the predefined members like i did in the schema.ts file to the relations.ts:
2. I create another authSchema file that defines usersInAuth as detailed here and import that: https://www.reddit.com/r/Supabase/comments/1d8yse0/comment/l7c64km/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_buttonReddit
paddyjoneill's comment on "Drizzle Introspect"
Explore this conversation and more from the Supabase community
what is
usersInAuth
? But do answer, yes you can re import again from /supabase
if it is authUsers. These imports are just here to be used as references in schema/relations