Closed ruzia closed 11 months ago
Not directly, but you can run migrations programmatically. You could then put that in an async block to achive the same. See this test case for an example for how you can run a migration programmatically: https://github.com/googleapis/ruby-spanner-activerecord/blob/5060fb51b29aefd3c015ec729eae03454ecfa8a7/test/migrations_with_mock_server/migrations_with_mock_server_test.rb#L66
@olavloite Thanks for reply! I see, but I would like to switch between async or not as needed in db:migrate if possible.
From looking at the code below, I thought it might work if, for example, I could pass wait_until_done
as an argument to ddl_batch
and then pass it to run_batch
as well.
What do you think?
Adding an index to a table with 100 million data items is very time consuming (like a day or more). The gcloud command has "--async", but is there any way to do the same thing with db:migrate in rails?