|
@@ -1,3 +1,7 @@
|
|
|
+use std::vec;
|
|
|
+
|
|
|
+use tauri_plugin_sql::{Migration, MigrationKind};
|
|
|
+
|
|
|
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
|
|
|
#[tauri::command]
|
|
|
fn greet(name: &str) -> String {
|
|
@@ -6,8 +10,18 @@ fn greet(name: &str) -> String {
|
|
|
|
|
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
|
|
pub fn run() {
|
|
|
+ let migrations = vec![Migration {
|
|
|
+ version: 1,
|
|
|
+ description: "create_initial_tables",
|
|
|
+ sql: include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/resources/init.sql")),
|
|
|
+ kind: MigrationKind::Up,
|
|
|
+ }];
|
|
|
tauri::Builder::default()
|
|
|
- .plugin(tauri_plugin_sql::Builder::new().build())
|
|
|
+ .plugin(
|
|
|
+ tauri_plugin_sql::Builder::default()
|
|
|
+ .add_migrations("sqlite:store.db", migrations)
|
|
|
+ .build(),
|
|
|
+ )
|
|
|
.plugin(tauri_plugin_opener::init())
|
|
|
.invoke_handler(tauri::generate_handler![greet])
|
|
|
.run(tauri::generate_context!())
|