mirror of
https://github.com/lumehq/lume.git
synced 2025-09-20 07:00:52 +02:00
replaced tauri-sql with prisma-client-rust
This commit is contained in:
2
src-tauri/.cargo/config.toml
Normal file
2
src-tauri/.cargo/config.toml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[alias]
|
||||||
|
prisma = "run --bin prisma --"
|
2
src-tauri/.gitignore
vendored
2
src-tauri/.gitignore
vendored
@@ -2,3 +2,5 @@
|
|||||||
# will have compiled files and executables
|
# will have compiled files and executables
|
||||||
/target/
|
/target/
|
||||||
|
|
||||||
|
# prisma
|
||||||
|
src/prisma.rs
|
||||||
|
2406
src-tauri/Cargo.lock
generated
2406
src-tauri/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -17,11 +17,10 @@ tauri-build = { version = "1.2", features = [] }
|
|||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
tauri = { version = "1.2", features = ["clipboard-read-text", "clipboard-write-text", "http-request", "os-all", "shell-open", "system-tray", "window-close", "window-start-dragging"] }
|
tauri = { version = "1.2", features = ["clipboard-read-text", "clipboard-write-text", "http-request", "os-all", "shell-open", "system-tray", "window-close", "window-start-dragging"] }
|
||||||
|
prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.7", default-features = false, features = ["sqlite", "migrations", "mocking", "specta"] }
|
||||||
[dependencies.tauri-plugin-sql]
|
prisma-client-rust-cli = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.7", default-features = false, features = ["sqlite", "migrations", "mocking", "specta"] }
|
||||||
git = "https://github.com/tauri-apps/plugins-workspace"
|
specta = "1.0.0"
|
||||||
branch = "dev"
|
tauri-specta = { version = "1.0.0", features = ["typescript"] }
|
||||||
features = ["sqlite"]
|
|
||||||
|
|
||||||
[target.'cfg(target_os = "macos")'.dependencies]
|
[target.'cfg(target_os = "macos")'.dependencies]
|
||||||
objc = "0.2.7"
|
objc = "0.2.7"
|
||||||
|
0
src-tauri/prisma/migrations/.keep
Normal file
0
src-tauri/prisma/migrations/.keep
Normal file
11
src-tauri/prisma/schema.prisma
Normal file
11
src-tauri/prisma/schema.prisma
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
datasource db {
|
||||||
|
provider = "sqlite"
|
||||||
|
url = "file:lume.db"
|
||||||
|
}
|
||||||
|
|
||||||
|
generator client {
|
||||||
|
// Corresponds to the cargo alias created earlier
|
||||||
|
provider = "cargo prisma"
|
||||||
|
// The location to generate the client. Is relative to the position of the schema
|
||||||
|
output = "../src/prisma.rs"
|
||||||
|
}
|
3
src-tauri/src/bin/prisma.rs
Normal file
3
src-tauri/src/bin/prisma.rs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fn main() {
|
||||||
|
prisma_client_rust_cli::run();
|
||||||
|
}
|
@@ -8,7 +8,6 @@
|
|||||||
extern crate objc;
|
extern crate objc;
|
||||||
|
|
||||||
use tauri::{Manager, WindowEvent};
|
use tauri::{Manager, WindowEvent};
|
||||||
use tauri_plugin_sql::{Migration, MigrationKind};
|
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
use window_ext::WindowExt;
|
use window_ext::WindowExt;
|
||||||
@@ -25,23 +24,11 @@ fn main() {
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
.plugin(
|
|
||||||
tauri_plugin_sql::Builder::default()
|
|
||||||
.add_migrations(
|
|
||||||
"sqlite:lume.db",
|
|
||||||
vec![Migration {
|
|
||||||
version: 1,
|
|
||||||
description: "create default tables",
|
|
||||||
sql: include_str!("../migrations/20230226004139_create_tables.sql"),
|
|
||||||
kind: MigrationKind::Up,
|
|
||||||
}],
|
|
||||||
)
|
|
||||||
.build(),
|
|
||||||
)
|
|
||||||
.on_window_event(|e| {
|
.on_window_event(|e| {
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
let apply_offset = || {
|
let apply_offset = || {
|
||||||
let win = e.window();
|
let win = e.window();
|
||||||
|
// keep inset for traffic lights when window resize (macos)
|
||||||
win.position_traffic_lights(8.0, 20.0);
|
win.position_traffic_lights(8.0, 20.0);
|
||||||
};
|
};
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
|
Reference in New Issue
Block a user