You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow adding indexes to columns created in the same migration (#454)
Allow the `create_index` operation to add an index to a column that was
created by an operation earlier in the same migration.
The following migration would previously have failed to start:
```json
{
"name": "43_multiple_ops",
"operations": [
{
"create_table": {
"name": "players",
"columns": [
{
"name": "id",
"type": "serial",
"pk": true
},
{
"name": "name",
"type": "varchar(255)",
"check": {
"name": "name_length_check",
"constraint": "length(name) > 2"
}
}
]
}
},
{
"add_column": {
"table": "players",
"column": {
"name": "rating",
"type": "integer",
"comment": "hello world",
"check": {
"name": "rating_check",
"constraint": "rating > 0 AND rating < 100"
},
"nullable": false
}
}
},
{
"create_index": {
"name": "idx_player_rating",
"table": "players",
"columns": [
"rating"
]
}
}
]
}
```
As of this PR the migration can be started.
The above migration does not validate yet, but it can be started
successfully with the `--skip-validation` flag to the `start` command.
Part of #239
0 commit comments