R
Railway7mo ago
x4zx

Will the database be updated?

I wanted to connect MongoDB to my Django project, but unfortunately it's not officially supported by Django (I know there are different solutions like djongo, but that doesn't work for me), so I wondered if I could use the standard database as a db.sqlite3 file. I'm not going to store any disproportionate amount of data, all I need is to store a single user in my person and a couple of dictionaries with data. So the question arises, can I do this? Does Railway allow me to update the db.sqlite3 file? Will it work?
Solution:
you dont ever want to have an sqlite database in your repo. yes your service would need a volume attached. your code would need to create an sqlite database on the volume if it doesnt already exist. your code would also need to run migrations upon creating the database file, or when the schema has changed....
Jump to solution
6 Replies
Percy
Percy7mo ago
Project ID: N/A
x4zx
x4zx7mo ago
Still, I don't understand the Django developers, why not add MongoDB support. In my opinion, it is one of the easiest to use databases and very convenient
Brody
Brody7mo ago
you can use sqlite if you store the sqlite database file in a volume https://docs.railway.app/reference/volumes but i wouldn’t really recommend that since there is no good way to grab a copy of the database for local development, or to upload your local sqlite databas to railway for that matter. instead just use postgres
x4zx
x4zx7mo ago
I don't think I'll have a need for a copy of the database, as I won't have any important data. Also I would like to clarify, when I remove db.sqlite3 from .gitignore and submit the update to GitHub do I have to manually add the volume to the GitHub project?
No description
Solution
Brody
Brody7mo ago
you dont ever want to have an sqlite database in your repo. yes your service would need a volume attached. your code would need to create an sqlite database on the volume if it doesnt already exist. your code would also need to run migrations upon creating the database file, or when the schema has changed.
x4zx
x4zx7mo ago
Got it, thank you salute