Skip to content

feat: generate default clause when table column NULL is changed#250

Merged
nielm merged 3 commits into
cloudspannerecosystem:mainfrom
gurminder71:main
Jun 26, 2026
Merged

feat: generate default clause when table column NULL is changed#250
nielm merged 3 commits into
cloudspannerecosystem:mainfrom
gurminder71:main

Conversation

@gurminder71

@gurminder71 gurminder71 commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

When either a NOT NULL clause on a table column is changed, both NOT NULL and any DEFAULT clauses need to appear in the ALTER TABLE ALTER COLUMN statement, otherwise DEFAULT is dropped.

eg:

# original: 
CREATE TABLE test (
  id STRING(36),
  enforcement_enabled BOOL DEFAULT (TRUE),
) PRIMARY KEY (id)

# new
CREATE TABLE test (
  id STRING(36),
  enforcement_enabled BOOL NOT NULL DEFAULT (TRUE),
) PRIMARY KEY (id)

# diff needs both NOT NULL and DEFAULT
ALTER TABLE test ALTER COLUMN enforcement_enabled BOOL NOT NULL DEFAULT (TRUE)

@nielm nielm merged commit cd1dabf into cloudspannerecosystem:main Jun 26, 2026
10 checks passed
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.

2 participants