-
Notifications
You must be signed in to change notification settings - Fork 106
Closed
Description
Hi community,
I recently found that we are not able to create index upon table creation.
Here is a minimum reproduce of errors:
{
"name": "01_test",
"operations": [
{
"create_table": {
"name": "test_user",
"columns": [
{
"name": "user_id",
"type": "int",
"pk": true
}
]
}
},
{
"create_index": {
"name": "idx_test_user_id",
"table": "test_user",
"columns": [
"user_id"
]
}
}
]
}
I got an error saying Failed to start migration: migration is invalid: table "test_user" does not exist
when running migrations.
We can walkaround by spliting migrations into two files, but it comes with a problem that might break the zero-downtime promise.
- We need to run migration sequencely, that said, I have to
complete
01_create_tableand then run
02_create_index`. - At which time point
01_create_table
is completed and I will not have a chance to roll it back if there is a bug in DDL.
If index creation is allowed upon table creation, it will make the migrations more compact.
Thanks!
acaloiaro, Smert and gulcin
Metadata
Metadata
Assignees
Labels
No labels