#New migrations added to tauri-plugin-sql not running?
12 messages · Page 1 of 1 (latest)
@fringe condor any idea here???
nope, no idea about sql migrations. Would be helpful if you can come up with a reproduction example for us though
Well I think the right question is how do we handle migrations in this new version, before there were example repo where we could see how the implementations were.
Oh, and am using tauri-plugin-sql with sqlite
not sure what you mean with "new version". Nothing changed api wise so the old examples still apply
[dependencies.tauri-plugin-sql]
git = "https://github.com/tauri-apps/tauri-plugin-sql?tag=v0.1.0"
features = ["sqlite"]
This is how I used to use it before, but now it was throwing errors so I upgraded to the one in the documentation. But it doesn't provide support for migration in the new docs found here https://github.com/tauri-apps/tauri-plugin-sql.
The new way is
[dependencies.tauri-plugin-sql]
git = "https://github.com/tauri-apps/plugins-workspace"
branch = "v1"
features = ["sqlite"]
check this link out https://github.com/yankeeinlondon/tauri-plugin-sql/blob/dev/examples/todos-app/src-tauri/src/main.rs
U can see how they are adding migrations
This was one of the PR that was merged into that main repo of tauri-plugin-sql for adding a VueJS example integration.
So, this is my current code, but its not running the migrations.
.plugin(
tauri_plugin_sql::Builder::default()
.add_migrations(
"sqlite:inventory_system.db",
vec![
Migration {
version: 5,
description: "added location on inventory table",
sql: include_str!("../migrations/5.sql"),
kind: MigrationKind::Up,
},
],
)
.build(),
)