removing the need of suplementing provider links in config

This commit is contained in:
Marek Maslowski
2026-04-04 14:20:52 +02:00
parent bca82b3f8c
commit 877e1a09cc
6 changed files with 42 additions and 34 deletions

View File

@@ -643,14 +643,13 @@ function runMigrations(db: Database.Database): void {
// Seed Synology Photos provider and fields in existing databases
try {
db.prepare(`
INSERT INTO photo_providers (id, name, description, icon, enabled, config, sort_order)
VALUES (?, ?, ?, ?, ?, ?, ?)
INSERT INTO photo_providers (id, name, description, icon, enabled, sort_order)
VALUES (?, ?, ?, ?, ?, ?)
ON CONFLICT(id) DO UPDATE SET
name = excluded.name,
description = excluded.description,
icon = excluded.icon,
enabled = excluded.enabled,
config = excluded.config,
sort_order = excluded.sort_order
`).run(
'synologyphotos',
@@ -658,12 +657,6 @@ function runMigrations(db: Database.Database): void {
'Synology Photos integration with separate account settings',
'Image',
0,
JSON.stringify({
settings_get: '/integrations/synologyphotos/settings',
settings_put: '/integrations/synologyphotos/settings',
status_get: '/integrations/synologyphotos/status',
test_post: '/integrations/synologyphotos/test',
}),
1,
);
} catch (err: any) {
@@ -691,6 +684,14 @@ function runMigrations(db: Database.Database): void {
if (!err.message?.includes('no such table')) throw err;
}
},
() => {
// Remove the stored config column from photo_providers now that it is generated from provider id.
const columns = db.prepare("PRAGMA table_info('photo_providers')").all() as Array<{ name: string }>;
const names = new Set(columns.map(c => c.name));
if (!names.has('config')) return;
db.exec('ALTER TABLE photo_providers DROP COLUMN config');
},
];
if (currentVersion < migrations.length) {