We use the awesome gem data-migrate with comes with a handy rake task to check if you have migrations pending. The task is really and extention to the task built in on rails but that also check for pending data migrations.
That rake task is available since version 6.3.0 of data-migrate. If you are stuck in an older version like I was here is a version of the rake task you can put in your project.
rake db:abort_if_pending_migrations:with_data
You can use this rake task in an init container to halt your deployments until you migrations are ready.
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-deployment
spec:
template:
spec:
initContainers:
- name: migrations-check
image: my-rails-app
args:
- rake
- db:abort_if_pending_migrations:with_data
containers:
- name: my-app
image: my-rails-app
...
@blackjid How to use it to show this error screen please?