Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fixing schemas and making migrations not crash

Marek Maslowskiba4bfc693a66
diff --git a/server/src/db/migrations.ts b/server/src/db/migrations.ts
index fd0be24d9..c9fd4ea49 100644
--- a/server/src/db/migrations.ts
+++ b/server/src/db/migrations.ts
@@ -693,15 +693,12 @@ function runMigrations(db: Database.Database): void {
db.exec('ALTER TABLE photo_providers DROP COLUMN config');
},
() => {
+ const columns = db.prepare("PRAGMA table_info('trip_photos')").all() as Array<{ name: string }>;
+ const names = new Set(columns.map(c => c.name));
+ if (names.has('asset_id') && !names.has('immich_asset_id')) return;
db.exec('ALTER TABLE `trip_photos` RENAME COLUMN immich_asset_id TO asset_id');
- },
- () => {
db.exec('ALTER TABLE `trip_photos` ADD COLUMN provider TEXT NOT NULL DEFAULT "immich"');
- },
- () => {
db.exec('ALTER TABLE `trip_album_links` ADD COLUMN provider TEXT NOT NULL DEFAULT "immich"');
- },
- () => {
db.exec('ALTER TABLE `trip_album_links` RENAME COLUMN immich_album_id TO album_id');
},
];
diff --git a/server/src/db/schema.ts b/server/src/db/schema.ts
index e053df674..f18c8d051 100644
--- a/server/src/db/schema.ts
+++ b/server/src/db/schema.ts
@@ -18,6 +18,8 @@ function createTables(db: Database.Database): void {
mfa_enabled INTEGER DEFAULT 0,
mfa_secret TEXT,
mfa_backup_codes TEXT,
+ immich_url TEXT,
+ immich_access_token TEXT,
synology_url TEXT,
synology_username TEXT,
synology_password TEXT,
@@ -166,6 +168,7 @@ function createTables(db: Database.Database): void {
place_id INTEGER REFERENCES places(id) ON DELETE SET NULL,
assignment_id INTEGER REFERENCES day_assignments(id) ON DELETE SET NULL,
title TEXT NOT NULL,
+ accommodation_id TEXT,
reservation_time TEXT,
reservation_end_time TEXT,
location TEXT,