Menu

drizzle-kit generate Duplicate ADD COLUMN: Stale Snapshot
πŸ“°

drizzle-kit generate Duplicate ADD COLUMN: Stale Snapshot

DEV Community: postgresΒ·cometa-kaitoΒ·about 2 hours ago
#TPFSPKNg
#devtopostgresql#devto#dev#column#drizzle
Reading 0:00
15s threshold

If a column addition isn't reflected in the drizzle snapshot, the next drizzle-kit generate re-emits an ADD COLUMN without IF NOT EXISTS .

Starting with the conclusion

For a column addition with no new table involved, don't rerun drizzle-kit generate β€” hand-edit the snapshot ( drizzle/meta/*.json ) directly to reflect the column definition. Leave it unreflected and the next generate will judge that column "not yet existing," re-emitting an ADD COLUMN with no IF NOT EXISTS . Applying that ALTER to an environment where the column already exists (via a hand-written migration) fails.

The symptom

On 2026-07-03 (#1205), running drizzle-kit generate to add a new table, class_weekly_schedules , produced a migration file that also re-emitted duplicate ADD COLUMN statements for class_visitors.sort_order and student_callouts.sort_order β€” columns already added by hand-written migrations 0034 and 0035.

-- (manually removed) drizzle-kit also generated ADD COLUMN for class_visitors / student_callouts -- sort_order…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.