From b0536765ceb2a4d71cca118fb437eea676843b98 Mon Sep 17 00:00:00 2001 From: Benjamin Toby Date: Mon, 21 Sep 2026 14:14:54 +0100 Subject: [PATCH] Update database schema. Client rules are randomly deleted because of the foreign key. Remove all foreign keys from db schema --- db/schema.ts | 14 -------------- src/scripts/install-wg-ui.sh | 2 +- src/server.ts | 2 +- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/db/schema.ts b/db/schema.ts index 2be45c1..a3c5172 100644 --- a/db/schema.ts +++ b/db/schema.ts @@ -140,13 +140,6 @@ const schema: BUN_SQLITE_DatabaseSchemaType = { { fieldName: "media_id", dataType: "INTEGER", - foreignKey: { - cascadeDelete: true, - destinationTableName: "media", - destinationTableColumnName: "id", - destinationTableColumnType: "INTEGER", - foreignKeyName: "media_paradigm_media_fk", - }, }, { fieldName: "media_paradigm", @@ -267,13 +260,6 @@ const schema: BUN_SQLITE_DatabaseSchemaType = { { fieldName: "client_id", dataType: "INTEGER", - foreignKey: { - cascadeDelete: true, - destinationTableName: "clients", - destinationTableColumnName: "id", - destinationTableColumnType: "INTEGER", - foreignKeyName: "client_rules_client_fk", - }, }, { fieldName: "rule_type", diff --git a/src/scripts/install-wg-ui.sh b/src/scripts/install-wg-ui.sh index 5a2f90b..fbe31e9 100755 --- a/src/scripts/install-wg-ui.sh +++ b/src/scripts/install-wg-ui.sh @@ -140,7 +140,7 @@ install_dependencies() { log "installing app dependencies with bun ..." cd "$INSTALL_DIR" "$BUN_BIN" install - "$BUN_BIN" db:schema + "$BUN_BIN" bun-sqlite schema } ensure_env_file() { diff --git a/src/server.ts b/src/server.ts index 1ff52f3..c9ea5cf 100644 --- a/src/server.ts +++ b/src/server.ts @@ -13,7 +13,7 @@ const port = SiteData["ServerPort"]; await bunext.bunextInit(); const server = Bun.serve({ - hostname: "0.0.0.0", + hostname: development ? "localhost" : "0.0.0.0", async fetch(req, server) { try { const url = new URL(req.url);