Help with SQLite DB on volume

a year ago

I have a nextjs app that uses prisma .

my DATABASE_URL="file:./data/history.db"

When i build I get this log:

12 23.50 4 migrations found in prisma/migrations

12 23.51 Applying migration 20240406185550_init

12 23.51 Applying migration 20240406190746_

12 23.52 Applying migration 20240406190823_rename

12 23.53 Applying migration 20240406192811_rename_to_celsius

12 23.55 The following migration(s) have been applied:

12 23.55 migrations/

12 23.55 └─ migration.sql

12 23.55 └─ migration.sql

12 23.55 └─ migration.sql

12 23.55 └─ migration.sql

12 23.55 All migrations have been successfully applied.

When I run the app though i get this:

The table main.WeatherRecord does not exist in the current database.

If the database_url is being interpreted the same both during build and run why would I be getting this error?

Is anyone else using SQLite via volume attached to their service?

0 Replies

a year ago

9f227eaa-51ec-450e-88f6-3b2a43a02dd8


a year ago

I would strongly recommend you use postgres going forward


a year ago

i've used postgres on many other projects, but this project seems like a perfect usecase for sqlite & railway volumes.


a year ago

where is the volume mounted to


a year ago

/app/data


a year ago

when i run locally the db ends up in /data/history.db


a year ago

although the volume seems semi irrelevant


a year ago

it's not between deploy persistence that's causing problems


a year ago

it's just accessing the db in the deployed app that's not working correctly…


a year ago

are you running migrations during build?


a year ago

yup


a year ago

When i build I get this log:

12 23.50 4 migrations found in prisma/migrations

12 23.51 Applying migration 20240406185550_init

12 23.51 Applying migration `20240406190746

12 23.52 Applying migration 20240406190823_rename

12 23.53 Applying migration 20240406192811renameto_celsius

12 23.55 The following migration(s) have been applied:

12 23.55 migrations/

12 23.55 └─ migration.sql

12 23.55 └─ migration.sql

12 23.55 └─ migration.sql

12 23.55 └─ migration.sql

12 23.55 All migrations have been successfully applied.


a year ago

the volume is not available during build


a year ago

you think this will do it?

1226343965930951000


a year ago

yep that's how I'd do it


a year ago

k lemme try that


a year ago

i'm dumb

1226344246450323500


a year ago

nah you aren't the first, that's why I asked the team to put that in the docs


a year ago

hot diggity


a year ago

that worked


a year ago

thanks man!


a year ago

no problem


AnonymousTRIAL

a year ago

Hi! I am thinking of using Sqlite for a project. And I wanted yo ask how you went around to not only connect your app to the Sqlite db in the volume, but also how you access it from a DB explorer (if you did something like this). In the docs it says "To access your files, you must do so via the attached service's mount point". But I am not entirely sure how to do so


a year ago

once you are using sqlite in a volume there is no way to access that sqlite file outside of railway, there is no database explorer for sqlite.

I would highly recommend postgres instead, it will make the development process much easier because it can be accessed both privately and publicly


Help with SQLite DB on volume - Railway Help Station