How do you run your database migrations when the application is hosted in AWS ECS?

If you’re running a Rails application on AWS ECS. How do you run your database migrations?

I know that one option is to use ECS Fargate as part of the deployment pipeline, add a task that runs db:migrate to check if there are any pending migrations and after it completes, continue with the deployment.

What other approaches would you recommend and what are the caveats/tradeoffs?