Skip to content

fix: preserve NOT NULL constraint in migrate_columns()#1435

Merged
dimitri-yatsenko merged 1 commit intomasterfrom
fix/1434-migrate-not-null
Apr 22, 2026
Merged

fix: preserve NOT NULL constraint in migrate_columns()#1435
dimitri-yatsenko merged 1 commit intomasterfrom
fix/1434-migrate-not-null

Conversation

@dimitri-yatsenko
Copy link
Copy Markdown
Member

Summary

  • migrate_columns() and legacy generate_migration_sql() issued MODIFY COLUMN without NOT NULL, causing MySQL to silently default columns to nullable
  • Added IS_NULLABLE to information_schema.COLUMNS queries in analyze_columns() and analyze_blob_columns()
  • Conditionally include NOT NULL in generated ALTER TABLE statements when the column was originally non-nullable

Fixes #1434

Test plan

  • Create table with NOT NULL blob column, run migrate_columns(), verify IS_NULLABLE remains NO
  • Create table with nullable blob column, run migrate_columns(), verify it remains nullable
  • Run migrate_columns(dry_run=True) and inspect generated SQL for correct NOT NULL placement

🤖 Generated with Claude Code

migrate_columns() and generate_migration_sql() issued MODIFY COLUMN
without NOT NULL, causing MySQL to silently default columns to nullable.
Add IS_NULLABLE to information_schema queries and conditionally include
NOT NULL in the generated ALTER TABLE statements.

Fixes #1434

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@dimitri-yatsenko dimitri-yatsenko requested review from esutlie, mweitzel and ttngu207 and removed request for mweitzel April 20, 2026 20:08
@dimitri-yatsenko dimitri-yatsenko merged commit dacf5ce into master Apr 22, 2026
7 checks passed
@dimitri-yatsenko dimitri-yatsenko deleted the fix/1434-migrate-not-null branch April 22, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

migrate_columns() silently drops NOT NULL constraint on blob columns

2 participants