How can I get warning when creating "Migration" with non nullable field

When I generate migration using the command drizzle-kit generate --config ./drizzle.config.ts I don't get any warnings for new fields that is non nullable. Shouldn't it warn me or ask for a default value? The generated SQL:
ALTER TABLE "profiles" ADD COLUMN "x" varchar NOT NULL;
ALTER TABLE "profiles" ADD COLUMN "x" varchar NOT NULL;
Config has these options
verbose: true,
strict: true,
schema: './packages/schema/**/*.ts',
dialect: 'postgresql',
dbCredentials: object
verbose: true,
strict: true,
schema: './packages/schema/**/*.ts',
dialect: 'postgresql',
dbCredentials: object
4 Replies
ragokan
ragokan•2w ago
I guess there isn't any option 😔
DoggeSlapper
DoggeSlapper•2w ago
Why would it warn u? It's totally fine to have a field not null without a default If u want to enforce something to be not null, but still dont want a default value how would you do it otherwsie? It's quite common scenario
ragokan
ragokan•2w ago
@DoggeSlapper but old profiles can't have non nullable field so, it will not migrate
DoggeSlapper
DoggeSlapper•2w ago
Ah I get what u want to do. I guess you need to use a custom migration and alter name of the column then move back or u delete all nulls I dont see how dirzzle could handle this automatically
Want results from more Discord servers?
Add your server