Hello, I’ve got a small django app in a fly instance. Recently, I added some migrations and wanted to run them. When I tried connecting through ssh after I entered the migrations command the command is stuck. Specifically I get the following output:
The run migrations command is stuck there, nothing happening no matter how long I leave it running. Taking a look at the logs, the only thing I see is output similar to this, every 15 seconds:
At the end of the deploy, it should tell you it’s running the release command. Do you see this in the deploy logs?
The one thing I noted was that you executed python manage.py migrate in /app, maybe the release command is being executed at /?
It seems like python manage.py migrate isn’t able to connect to your database.
When you attach a pg instance, fly.io places a DATABASE_URL onto your instance.
Is manage.py using DATABASE_URL to connect to the instance?
Hello @Alex_Piechowski thanks for replying but that’s not the problem. From the same shell where the migrations are not run I can do a python manage.py shell and query the database without problems.
Ooh, what if it’s just a really long migration and it’s not actually hanging, but doing work?
What are the contents of the migration file that it is hanging on?
Could you try running the migration, then also querying pg_stat_activity to see if thee’s a hung DDL operation? :
@Alex_Piechowski exactly the same! The DDL query hangs forever until the database stops it. I even tried suspending the app and connecting to the database to execute the query. Still the same behavior !