db file not carrying over to new deployment
i'm using better-sqlite3
it seems that the db file is just falling back to the last save I had before hosting on railway every time I make a new deployment
but all updates made in the current deployment stays, just resets when I redeploy
13 Replies
Project ID:
b4d97cb6-a8a0-4eb4-a9b3-6a249948870d
It looks like the issue is related to the database itself, and that the storage inside the railway containers is ephemeral. To preserve the application's data across deployments, you will need to set up logging for when the app is running in production, and add a simple API route which just returns a basic JSON. You can also try running an interactive console, like
heroku run rails c
.⚠️ experimental feature
This is expected, storage isn't persistent so the database is reset with every deployment
is there a way I can make it persistent
You'll want to use the mysql database, should be easy enough to swap out
oh I see, sorry I'm very knew to online hosting
how will that make it persistent?
Those databases don't get wiped because the data is not stored in your project folder
ooh alright, any config I have to do on the project itself or do I just add it like I would if I hosted it locally
Railway can provide a mysql database for you, you just add it to your project, it will generate a set of variables, you use those variables to connect to the database
🥴 that sounds confusing, I'll watch some tutorials on it
thanks for your help Brody!
nah don't worry, it's not much more complicated than sqlite
ah alright :D
Though it seems like you might be using an orm wrapper, I'm sure you can find a good orm wrapper for mysql too