Coder Social home page Coder Social logo

Comments (3)

rylev avatar rylev commented on August 21, 2024

Thanks for filing the issue!

So, I'm not surprised that it doesn't work with Spin v2.6.0, but I am surprised that it seemed to have worked in Spin v2.5.1. I tried to reproduce the error with Spin v2.6.0 and v2.5.1, and I received the error message using both versions.

I believe the route cause is that you're missing a runtime-config-file that specifies where these databases live.

You can see a link in the error message to the docs that describe this:

Check the spelling, or pass a runtime configuration file that defines these stores.
See https://developer.fermyon.com/spin/dynamic-configuration#sqlite-storage-runtime-configuration

You'll need to define your databases like so in a runtime-config.toml file:

[sqlite_database.vehicle]
type = "spin"
path = "path/to/your/database.db"

[sqlite_database.update-status]
type = "spin"
path = "path/to/your/database.db"

And then you run the app with the runtime config file:

spin up --runtime-config-file runtime-config.toml

Let me know if this helps, or if you're still running into issues.

from spin.

melihomay avatar melihomay commented on August 21, 2024

Thank you very much, it's actually running as usual again.

But what puzzles me is that with the "runtime-config.toml", there should be a "database.db" in each target folder?

# This defines a new store named vehicle
[sqlite_database.vehicle]
type = "spin"
path = "vehicle/database.db"

# This defines a new store named update-status
[sqlite_database.update-status]
type = "spin"
path = "update_status/database.db"

When calling the command line

spin up --runtime-config-file runtime-config.toml

nothing happens at first (no db files are created).

So I called my migration scripts.

spin build --up --sqlite @migration_vehicle.sql --sqlite @migration_update_status.sql --runtime-config-file runtime-config.toml

This has the effect of creating a file “sqlite_db.db” in the “.spin” folder, in which two tables are created:

• update-status
• vehicle

I suspect that the error occurred when updating from 2.5.1 to 2.6 because I created the sqlite_db.db using the migration scripts.

  1. Am I using the “spin.toml” and the “runtime-config.toml” incorrectly?
  2. Unfortunately, the documentation does not indicate how to create a physical separation with a migration.

Best regards

from spin.

rylev avatar rylev commented on August 21, 2024

Ah yes, I see where the issue is now. Currently all migration files passed to --sqlite are executed against the "default" database - i.e., the database that is always available under the "default" label.

You, however, would like to run migrations against other databases (which is a very reasonable thing to want to do). I've opened #2610 which would change spin up such that the name of the migration file is used to specify which database to run the sql file against.

Once that PR lands, you would run spin up like this:

spin build --up --sqlite @vehicle.sql --sqlite @update-status.sql --runtime-config-file runtime-config.toml

note the change to the sql files so that they match the names of the databases they're supposed to be run against

from spin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.