work on database structure and added function stubs for file entry

This commit is contained in:
Iaphetes 2025-03-13 21:25:21 +01:00
parent 615e09db16
commit 5b31b76e69

View file

@ -4,9 +4,9 @@ use std::{
path::Path,
};
use crate::get_basepath;
use sqlx::{migrate::MigrateDatabase, Sqlite, SqlitePool};
use tauri::{ipc::RuntimeCapability, App, AssetResolver, Manager, Url};
use crate::get_basepath;
async fn populate_file_db(db: &SqlitePool) {}
#[tauri::command]
@ -15,7 +15,6 @@ pub async fn initialize_database(
basepath: String,
pathtemplate: String,
) {
if let Some(basepath) = get_basepath(app_handle.clone()) {
let db_path = Path::new("Documents")
.join(Path::new("Knowledgebase"))
@ -55,10 +54,12 @@ pub async fn initialize_database(
let result = sqlx::query(
"CREATE TABLE IF NOT EXISTS file_diffs
(
id INTEGER PRIMARY KEY NOT NULL,
id INTEGER NOT NULL,
client_id INTEGER NOT NULL,
diff_text TEXT NOT NULL,
FOREIGN KEY (id)
REFERENCES files (file_id)
PRIMARY KEY (id, client_id)
)
;",
)
@ -69,6 +70,6 @@ pub async fn initialize_database(
}
#[tauri::command]
async fn store_diff(diff: String) {
async fn store_diff(diff: String) {}
}
async fn add_file(file_path: String, file_name: String) {}