Open chrisjh opened 1 year ago
Do you have a solution for this?
PostgresError: relation "authorization.user" does not exist
me bug
Similar issue when generating migrations with drizzle-kit -, the schema is never referenced in the SQL script's fk
I'm running into the same issue π it'd be nice to get some more info from the error too if possible ie. where is this happening and what's causing it (what tables/fields).
- error node_modules/postgres/src/connection.js (771:25) @ postgres
- error PostgresError: operator does not exist: text = uuid
at Socket.emit (node:events:513:28)
digest: "1620123906"
is what I'm getting back
+1 here
What version of
drizzle-orm
are you using?0.27.0
What version of
drizzle-kit
are you using?0.19.2
Describe the Bug
I use the default Postgres Public schema with a Users table ("public.users") and an Auth schema with a Users table from Supabase ("auth.users").
Users can have many AuthUsers (aka multiple authentication methods to log in). This is represented via a join table Identities as I can't write to Supabase's auth.users table.
I've defined them as follows in the Drizzle schema:
What I've found is that the types aren't being inferred correctly for the identity <> auth_user relation as seen here:
Where
auth_user: One<"users", true
> is inferring "users" instead of the "auth_users" table from the auth schema.Running a relational query like this:
Will result is an error:
Which is a Postgres level error βΒ it seems this is because instead of comparing identies.auth_uid (uuid) and auth_users.id (uuid) it's comparing it to users.id (text)
Thanks for taking a look!
Expected behavior
I would expect the correct postgres schema + table combination to be used when doing a relational query.
Environment & setup
All environments.