3 months ago
I am using django tenants and after deploying i am having a hard time trying to migrate the tenant apps from my terminal. Is there any railway terminal where i can make migrations on the railway enviroment?
3 Replies
3 months ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
3 months ago
You can use Railway CLI https://docs.railway.com/guides/cli
>i can make migrations on the railway enviroment?
Do you refer to migrations of services inside Railway?
3 months ago
Yes, Railway provides a terminal interface to run commands directly in your deployed services via the Railway CLI's SSH feature.
## Running Django Migrations on Railway
Using Railway SSH:
1. Copy the SSH command from the Dashboard:
- Navigate to your project in the Railway dashboard
- Right-click on your Django service
- Select "Copy SSH Command"
2. Execute migrations directly:
railway ssh -- python manage.py migrateOr for django-tenants specifically:
railway ssh -- python manage.py migrate_schemas3. Interactive session (if needed):
You can also open an interactive shell in your container:
railway sshThen run your migration commands directly inside the container.
Things to consider
- Service must be running: Your service needs to be actively deployed and running for SSH access to work.
- Environment variables available: When you SSH into the container, all your Railway environment variables are already available, including database credentials.
- Temporary access pattern: Use SSH for debugging and one-off operations like migrations. For recurring migrations, consider automating them in your deployment pipeline via the CLI or a startup command.
For more details on Railway SSH capabilities, see the SSH documentation