Skip to content

Commit ea1ad23

Browse files
authored
Merge pull request #1497 from fosrl/dev
Dev
2 parents acba944 + 7ffc5e0 commit ea1ad23

File tree

4 files changed

+73
-2
lines changed

4 files changed

+73
-2
lines changed

install/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ func main() {
220220
}
221221
}
222222

223-
if !config.HybridMode && checkIsPangolinInstalledWithHybrid() {
223+
if !config.HybridMode {
224224
// Setup Token Section
225225
fmt.Println("\n=== Setup Token ===")
226226

server/lib/consts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import path from "path";
22
import { fileURLToPath } from "url";
33

44
// This is a placeholder value replaced by the build process
5-
export const APP_VERSION = "1.10.0";
5+
export const APP_VERSION = "1.10.1";
66

77
export const __FILENAME = fileURLToPath(import.meta.url);
88
export const __DIRNAME = path.dirname(__FILENAME);

server/setup/migrationsSqlite.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import m22 from "./scriptsSqlite/1.7.0";
2727
import m23 from "./scriptsSqlite/1.8.0";
2828
import m24 from "./scriptsSqlite/1.9.0";
2929
import m25 from "./scriptsSqlite/1.10.0";
30+
import m26 from "./scriptsSqlite/1.10.1";
3031

3132
// THIS CANNOT IMPORT ANYTHING FROM THE SERVER
3233
// EXCEPT FOR THE DATABASE AND THE SCHEMA
@@ -53,6 +54,7 @@ const migrations = [
5354
{ version: "1.8.0", run: m23 },
5455
{ version: "1.9.0", run: m24 },
5556
{ version: "1.10.0", run: m25 },
57+
{ version: "1.10.1", run: m26 },
5658
// Add new migrations here as they are created
5759
] as const;
5860

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import { APP_PATH } from "@server/lib/consts";
2+
import Database from "better-sqlite3";
3+
import path from "path";
4+
5+
const version = "1.10.1";
6+
7+
export default async function migration() {
8+
console.log(`Running setup script ${version}...`);
9+
10+
const location = path.join(APP_PATH, "db", "db.sqlite");
11+
const db = new Database(location);
12+
13+
try {
14+
db.pragma("foreign_keys = OFF");
15+
16+
db.transaction(() => {
17+
db.exec(`ALTER TABLE "targets" RENAME TO "targets_old";
18+
--> statement-breakpoint
19+
CREATE TABLE "targets" (
20+
"targetId" INTEGER PRIMARY KEY AUTOINCREMENT,
21+
"resourceId" INTEGER NOT NULL,
22+
"siteId" INTEGER NOT NULL,
23+
"ip" TEXT NOT NULL,
24+
"method" TEXT,
25+
"port" INTEGER NOT NULL,
26+
"internalPort" INTEGER,
27+
"enabled" INTEGER NOT NULL DEFAULT 1,
28+
"path" TEXT,
29+
"pathMatchType" TEXT,
30+
FOREIGN KEY ("resourceId") REFERENCES "resources"("resourceId") ON UPDATE no action ON DELETE cascade,
31+
FOREIGN KEY ("siteId") REFERENCES "sites"("siteId") ON UPDATE no action ON DELETE cascade
32+
);
33+
--> statement-breakpoint
34+
INSERT INTO "targets" (
35+
"targetId",
36+
"resourceId",
37+
"siteId",
38+
"ip",
39+
"method",
40+
"port",
41+
"internalPort",
42+
"enabled",
43+
"path",
44+
"pathMatchType"
45+
)
46+
SELECT
47+
targetId,
48+
resourceId,
49+
siteId,
50+
ip,
51+
method,
52+
port,
53+
internalPort,
54+
enabled,
55+
path,
56+
pathMatchType
57+
FROM "targets_old";
58+
--> statement-breakpoint
59+
DROP TABLE "targets_old";`);
60+
})();
61+
62+
db.pragma("foreign_keys = ON");
63+
64+
console.log(`Migrated database`);
65+
} catch (e) {
66+
console.log("Failed to migrate db:", e);
67+
throw e;
68+
}
69+
}

0 commit comments

Comments
 (0)