© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•2y ago•
3 replies
Baran

Can't alter column from `.notNull()` to `allow null`

Background

I have an SQLite db, and a schema.
// schema.ts
export const T1 = sqliteTable(
  'T1',
  {
    // ...
    C1: text('C1').notNull(),
    // ...
  },
);
// schema.ts
export const T1 = sqliteTable(
  'T1',
  {
    // ...
    C1: text('C1').notNull(),
    // ...
  },
);

I edited my schema to:
// schema.ts
export const T1 = sqliteTable(
  'T1',
  {
    // ...
    C1: text('C1'),
    // ...
  },
);
// schema.ts
export const T1 = sqliteTable(
  'T1',
  {
    // ...
    C1: text('C1'),
    // ...
  },
);

Aim

Assuming the business logic is correct, I aimed to migrate my database with
drizzle-kit generate
drizzle-kit generate
and <apply migration script>.

Problem

However, after running the generate script, no migration was generated. How can I make C1 allow
NULL
NULL
values?

Environment

    "drizzle-kit": "^0.23.0",
    "drizzle-orm": "^0.31.0",
    "drizzle-kit": "^0.23.0",
    "drizzle-orm": "^0.31.0",


Related SEO tags so others can find the problem and the solution quicker: NOT NULL constraint failed
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Conditional NotNull Column?
Drizzle TeamDTDrizzle Team / help
16mo ago
TypeError unless column is notNull
Drizzle TeamDTDrizzle Team / help
13mo ago
`null` is not assignable to nullable string column?
Drizzle TeamDTDrizzle Team / help
2y ago
Alter type enum column ending in replace rather than alter
Drizzle TeamDTDrizzle Team / help
2y ago