Foreign keys default to NOT NULL with PostgreSQL
I currently have these two tables. I don't understand why Drizzle keeps generating foreign keys with the NOT NULL constraints. I'd really appreciate any help regarding this, been bashing my head against the keyboard for so many hours now. Thanks a lot.
Below is the generated migration file
4 Replies
Serial is not null by default. That not null might not be doing anything actually
PostgreSQL Documentation
8.1. Numeric Types
8.1. Numeric Types # 8.1.1. Integer Types 8.1.2. Arbitrary Precision Numbers 8.1.3. Floating-Point Types 8.1.4. Serial Types Numeric types consist of …
I understand. I want the DB to auto-generate PKs and have 0-1 to 1 relationship with those PKs from other tables. I saw this PR (https://github.com/drizzle-team/drizzle-orm/pull/1471) is still open so should I expect this feature to land in the next release? For the meantime I would just use nanoid in javascript to insert records.
GitHub
Feat: Drizzle-ORM support for Generated columns by Angelelz · Pull ...
This PR will close #261, will close #579 and will close #1464.
The API for generated columns will look like this:
const users = sqliteTable(
'users',
{
id: int('id').primary...
I'm not sure about next release but it's in the pipeline