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
Percy
Percy2y ago
Project ID: b4d97cb6-a8a0-4eb4-a9b3-6a249948870d
Percy
Percy2y ago
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
Brody
Brody2y ago
This is expected, storage isn't persistent so the database is reset with every deployment
Fragly
FraglyOP2y ago
is there a way I can make it persistent shy
Brody
Brody2y ago
You'll want to use the mysql database, should be easy enough to swap out
Fragly
FraglyOP2y ago
oh I see, sorry I'm very knew to online hosting how will that make it persistent?
Brody
Brody2y ago
Those databases don't get wiped because the data is not stored in your project folder
Fragly
FraglyOP2y ago
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
Brody
Brody2y ago
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
Fragly
FraglyOP2y ago
🥴 that sounds confusing, I'll watch some tutorials on it thanks for your help Brody!
Brody
Brody2y ago
nah don't worry, it's not much more complicated than sqlite
Fragly
FraglyOP2y ago
ah alright :D
Brody
Brody2y ago
Though it seems like you might be using an orm wrapper, I'm sure you can find a good orm wrapper for mysql too
Want results from more Discord servers?
Add your server