-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support creating foreign key constraints on the create table operation (
#79) Allow creating foreign key columns when doing a **create table** operation. For example: ```json { "name": "19_create_orders_table", "operations": [ { "create_table": { "name": "orders", "columns": [ { "name": "id", "type": "serial", "pk": true }, { "name": "user_id", "type": "integer", "references": { "table": "users", "column": "id" } }, { "name": "quantity", "type": "int" } ] } } ] } ``` Here the `user_id` column references the `id` column in the `users` table. The constraint is added to the table on `Start` and removed on `Rollback`.
- Loading branch information
1 parent
0341c94
commit f94d252
Showing
5 changed files
with
296 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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,29 @@ | ||
{ | ||
"name": "19_create_orders_table", | ||
"operations": [ | ||
{ | ||
"create_table": { | ||
"name": "orders", | ||
"columns": [ | ||
{ | ||
"name": "id", | ||
"type": "serial", | ||
"pk": true | ||
}, | ||
{ | ||
"name": "user_id", | ||
"type": "integer", | ||
"references": { | ||
"table": "users", | ||
"column": "id" | ||
} | ||
}, | ||
{ | ||
"name": "quantity", | ||
"type": "int" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |
This file contains 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 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 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 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