Comments (5)
Yes, I put my migration files inside db
folder in my sample app and I target it this way
This is because when embedding a folder, it will embed EVERYTHING in this folder. So you have to create a specific folder with only your migration files. That is if you want to optimize your app and not put your entire project inside the embedded folder. I may have not explained this part, indeed. WIll add a note somewhere to explain why it is done this way and why it is a best practice to do this.
About the scaffolding, it is in general done when your project is empty. I can totally see a use case where you want to scaffold a project based on dir property that you set in the configuraton file. Noted!
from surrealdb-migrations.
Hi Johan,
Are you able to share a reproducible project that can lead to this error? The error is pretty clear, it says it can't find a schemas
folder in your project but I cannot see the reason why at the moment.
Thank you.
from surrealdb-migrations.
Know you mention this. This is a release build of the app that it is shipped to a other location to run. In that location there are no folders of the migration present since the app is in /usr/bin
. This explains the error.
Can't you embed the folders that are needed?
from surrealdb-migrations.
Yes, you can perfectly run your app in an embedded context. There is a function called load_files
which will use embedded folder instead of the running filesystem folder.
Check the docs here: https://docs.rs/surrealdb-migrations/latest/surrealdb_migrations/struct.MigrationRunner.html#method.load_files
If you want a more concrete example, there is a sample app in this project. It is designed to run in a WASM embedded context but it will be similar to any other kind of embedded context. The sample can be found on this repository here: https://github.com/Odonno/surrealdb-migrations/blob/main/samples/wasm/rsw-hello/src/lib.rs
from surrealdb-migrations.
@Odonno thanks for the tip and yes this worked.
I used the WASM example but I have a few improvements:
When you run the scaffold example on the readme it created directories in the root dir. Because of this it is immediately incompatible for binary/wasm shipment. In the configuration section it mentions the path dir.
To my opinion the WASM/Embed use case could have more explanation on how to achieve this and maybe make the default dir compatible like your wasm example and put it into /db
.
You may close this if you like.
from surrealdb-migrations.
Related Issues (20)
- Migrate tests to cargo-nextest
- Split test library
- Running `cargo install surrealdb-migrations` currently fails HOT 2
- Running large migration file fails HOT 3
- Beta and nightly version support HOT 3
- Thankyou HOT 3
- Feature: Seeding HOT 3
- Feature: Publish to Homebrew
- Unable to install surrealdb-migrations error[E0658]: use of unstable library feature 'stdsimd' HOT 4
- Feature: use local config files HOT 2
- Bug: `READONLY` keyword HOT 1
- Provide a way to load migrations from a dir at runtime (not embedded) HOT 10
- Crate documentation not build for 1.2.0 HOT 2
- "`sql2` is currently unstable. You need to enable the `surrealdb_unstable` flag to use it." HOT 7
- find alternative to 'names' crate HOT 2
- Failed to apply database migrations: _initial.json file not found in the migrations/definitions directory HOT 7
- Running `cargo install surrealdb-migrations' fails HOT 3
- Make new release for SurrealDB 1.4.0 HOT 2
- Cannot create JWKS token HOT 1
- Unable to install via Cargo HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from surrealdb-migrations.