Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 5309 alter table add column if not exists #5311

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

griffio
Copy link
Contributor

@griffio griffio commented Jun 20, 2024

fixes #5309

Support IF NOT EXISTS in ALTER TABLE ADD COLUMN ...

Added override rule for alter_table_add_column as redeclared for extra clause
Added custom mixin to prevent duplicate property field in data class when using IF NOT EXISTS and column exists already

CREATE TABLE T (
  id INTEGER,
  txt VARCHAR[]
);

ALTER TABLE T ADD COLUMN IF NOT EXISTS txt VARCHAR[] DEFAULT '{}';

Added migration integration test

@griffio griffio changed the title Fix 5309 alter column if not exists Fix 5309 alter table add column if not exists Jun 21, 2024
@griffio griffio marked this pull request as ready for review June 21, 2024 09:38
@griffio griffio force-pushed the fix-5309-alter-column-if-not-exists branch from 11a4c48 to 5ebb8fd Compare June 22, 2024 15:08
Add mixin to handle IF NOT EXISTS clause
The new column will not be added if it already exists and IF NOT EXISTS clause is specified
migration file test
@griffio griffio force-pushed the fix-5309-alter-column-if-not-exists branch from 5ebb8fd to 1184be7 Compare June 25, 2024 16:08
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.

Cannot use a simple migration statement
1 participant