-
Notifications
You must be signed in to change notification settings - Fork 102
Add support for exclusion constraints in create_table
operation
#624
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
Merged
Merged
Changes from all commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
5908c19
mi folyik itt gyongyoson?
kvch c9ef10d
update generated file
kvch 03b3952
first batch
kvch f84b9a7
more updates
kvch 296731e
validation
kvch 766ddbc
add table constraint
kvch 965f28f
minor fixes
kvch abd6aed
add missing fixes
kvch b1dba4a
moreeee
kvch a0e918c
add default values
kvch 1ef47fd
uppercase
kvch 253e436
add validation test
kvch fd54808
rm messages
kvch b088ffd
deparse storage params
kvch e0acc68
init check constraints
kvch 90c548d
Merge remote-tracking branch 'upstream/main' into feature-add-table-c…
kvch dab75c2
add deparsing
kvch cb7b922
add docs
kvch 00bb93f
inimini
kvch cf25acc
even more
kvch f33c2ea
rm unnecessary test
kvch 8f9ecf6
update pr
kvch f187b8b
fmt
kvch 1e527e7
add missing updates
kvch f292e82
initialize primary key constraint
kvch f432d75
Merge remote-tracking branch 'upstream/main' into feature-add-table-c…
kvch d788e69
add jsonschema tests
kvch 3e54252
rm duplicate
kvch da60072
edit comments
kvch 981df44
add support for foreign key constraints
kvch 40dc814
add tests
kvch cbf5043
add e2e
kvch b63d0e0
update test
kvch fcfdd15
Merge remote-tracking branch 'upstream/main' into feature-add-table-c…
kvch f0913a3
add example
kvch c82f830
minor fix
kvch 385e7d5
add jsonschema tests
kvch 37393e9
update test
kvch be2830c
fix table name
kvch 1e0d403
pass match_type to schema.foreignkey
kvch c30e0c5
Merge remote-tracking branch 'upstream/main' into feature-add-table-c…
kvch d6f9cf7
Address review notes and add new attribute
kvch 1a9eb26
Document new option on_delete_set_columns
kvch 0ee70ea
Add more assertions to e2e test
kvch b47ade4
fix
kvch eb3965d
adjust expected
kvch 115af43
mr
kvch ed04cdf
improve validation
kvch 1da339a
add missing file
kvch 2a76649
support setting columns
kvch 6e03cb5
skip new tests
kvch b30a1b5
mivan?
kvch 3b0d39e
put support in the correct place
kvch 312cf21
init
kvch ea0e487
Merge remote-tracking branch 'upstream/main' into feature-add-table-c…
kvch 51ce6a5
add exclude constraint
kvch 6c448e7
even more
kvch 8e060ce
fix test
kvch 2c387fb
add missing extension
kvch a141333
always extension
kvch c1e11ce
install extension
kvch e57c361
most jo lesz?
kvch 5bf85b6
miert
kvch e30a35e
clean
kvch 7004ff5
move
kvch d9e51b5
update dep
kvch 76122d2
more
kvch 3a90684
rm extension
kvch 1d301bb
fix name
kvch b943ed5
rename example table
kvch 9e5d6a4
really fix example
kvch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"name": "52_create_table_with_table_exclusion_constraint", | ||
"operations": [ | ||
{ | ||
"create_table": { | ||
"name": "library", | ||
"columns": [ | ||
{ | ||
"name": "id", | ||
"type": "serial" | ||
}, | ||
{ | ||
"name": "returned", | ||
"type": "timestamp" | ||
}, | ||
{ | ||
"name": "title", | ||
"type": "text" | ||
}, | ||
{ | ||
"name": "summary", | ||
"type": "text" | ||
} | ||
], | ||
"constraints": [ | ||
{ | ||
"name": "rooms_pk", | ||
"type": "primary_key", | ||
"columns": [ | ||
"id" | ||
] | ||
}, | ||
{ | ||
"name": "forbid_duplicated_titles", | ||
"type": "exclude", | ||
"exclude": { | ||
"index_method": "btree", | ||
"elements": "title WITH =", | ||
"predicate": "title IS NOT NULL" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
internal/jsonschema/testdata/create-table-16-invalid-exclusion-missing-exclusion.txtar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
This is an invalid 'create_table' migration. | ||
Exclusion constraints must have exclude configured | ||
|
||
-- create_table.json -- | ||
{ | ||
"name": "migration_name", | ||
"operations": [ | ||
{ | ||
"create_table": { | ||
"name": "posts", | ||
"columns": [ | ||
{ | ||
"name": "title", | ||
"type": "varchar(255)" | ||
}, | ||
{ | ||
"name": "user_id", | ||
"type": "integer", | ||
"nullable": true | ||
} | ||
], | ||
"constraints": [ | ||
{ | ||
"name": "my_invalid_fk", | ||
"type": "exclude" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
|
||
-- valid -- | ||
false |
39 changes: 39 additions & 0 deletions
39
internal/jsonschema/testdata/create-table-17-invalid-exclusion-columns-set.txtar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
This is an invalid 'create_table' migration. | ||
Exclusion constraints mustn't have columns configured | ||
|
||
-- create_table.json -- | ||
{ | ||
"name": "migration_name", | ||
"operations": [ | ||
{ | ||
"create_table": { | ||
"name": "posts", | ||
"columns": [ | ||
{ | ||
"name": "title", | ||
"type": "varchar(255)" | ||
}, | ||
{ | ||
"name": "user_id", | ||
"type": "integer", | ||
"nullable": true | ||
} | ||
], | ||
"constraints": [ | ||
{ | ||
"name": "my_invalid_exclusion", | ||
"type": "exclude", | ||
"columns": ["invalid"], | ||
"exclude": { | ||
"index_method": "btree", | ||
"elements": "title WITH =" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
|
||
-- valid -- | ||
false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.