Why can't I insert fields that have already been defined in the table?
This is my user schema
This is my seed file
When I execute the seed.ts file,
it works !
It inserts 10 pieces of data into the database.
But when I tried to add the password field, the typescript prompted me that there was no password field in the users table.
May I ask why this is? Is there a problem with the type derivation of
NodePgDatabase<typeof schema>
Is there any expert who can help answer this?
Thank you very much!
4 Replies
I am not an expert, sorry. But looking at this I feel it has something to do with password being nullable maybe. It seems to be the only difference with the other fields. It's not actually helpful, but it is something you can try to narrow down the issue.
Thank you for your reply😆 , but in my work, password fields are allowed to be empty. I don't understand why fields without the notNull() modifier won't have type prompts
Me neither, but maybe try it to narrow it down
If the issue is in the missing notNull, we know where to look for a solution
https://github.com/drizzle-team/drizzle-orm/issues/4219 from another question in here, seems the same.
GitHub
[BUG]: (drizzle-orm/sqlite-core) SQLite Schemas do not support null...
Report hasn't been filed before. I have verified that the bug I'm about to report hasn't been filed before. What version of drizzle-orm are you using? 0.40.0 What version of drizzle-kit...