feat(appstore): add remote app store templates with service upgrades and Redis/MariaDB platform support
This commit is contained in:
12
ts/database/migrations/migration-013-app-template-version.ts
Normal file
12
ts/database/migrations/migration-013-app-template-version.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { BaseMigration } from './base-migration.ts';
|
||||
import type { TQueryFunction } from '../types.ts';
|
||||
|
||||
export class Migration013AppTemplateVersion extends BaseMigration {
|
||||
readonly version = 13;
|
||||
readonly description = 'Add app template tracking columns to services';
|
||||
|
||||
up(query: TQueryFunction): void {
|
||||
query('ALTER TABLE services ADD COLUMN app_template_id TEXT');
|
||||
query('ALTER TABLE services ADD COLUMN app_template_version TEXT');
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import { Migration009BackupSystem } from './migration-009-backup-system.ts';
|
||||
import { Migration010BackupSchedules } from './migration-010-backup-schedules.ts';
|
||||
import { Migration011ScopeColumns } from './migration-011-scope-columns.ts';
|
||||
import { Migration012GfsRetention } from './migration-012-gfs-retention.ts';
|
||||
import { Migration013AppTemplateVersion } from './migration-013-app-template-version.ts';
|
||||
import type { BaseMigration } from './base-migration.ts';
|
||||
|
||||
export class MigrationRunner {
|
||||
@@ -42,6 +43,7 @@ export class MigrationRunner {
|
||||
new Migration010BackupSchedules(),
|
||||
new Migration011ScopeColumns(),
|
||||
new Migration012GfsRetention(),
|
||||
new Migration013AppTemplateVersion(),
|
||||
].sort((a, b) => a.version - b.version);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,9 @@ export class ServiceRepository extends BaseRepository {
|
||||
name, image, registry, env_vars, port, domain, container_id, status,
|
||||
created_at, updated_at,
|
||||
use_onebox_registry, registry_repository, registry_image_tag,
|
||||
auto_update_on_push, image_digest, platform_requirements
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
auto_update_on_push, image_digest, platform_requirements,
|
||||
app_template_id, app_template_version
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
[
|
||||
service.name,
|
||||
service.image,
|
||||
@@ -36,6 +37,8 @@ export class ServiceRepository extends BaseRepository {
|
||||
service.autoUpdateOnPush ? 1 : 0,
|
||||
service.imageDigest || null,
|
||||
JSON.stringify(service.platformRequirements || {}),
|
||||
service.appTemplateId || null,
|
||||
service.appTemplateVersion || null,
|
||||
]
|
||||
);
|
||||
|
||||
@@ -123,6 +126,14 @@ export class ServiceRepository extends BaseRepository {
|
||||
fields.push('include_image_in_backup = ?');
|
||||
values.push(updates.includeImageInBackup ? 1 : 0);
|
||||
}
|
||||
if (updates.appTemplateId !== undefined) {
|
||||
fields.push('app_template_id = ?');
|
||||
values.push(updates.appTemplateId);
|
||||
}
|
||||
if (updates.appTemplateVersion !== undefined) {
|
||||
fields.push('app_template_version = ?');
|
||||
values.push(updates.appTemplateVersion);
|
||||
}
|
||||
|
||||
fields.push('updated_at = ?');
|
||||
values.push(Date.now());
|
||||
@@ -179,6 +190,8 @@ export class ServiceRepository extends BaseRepository {
|
||||
includeImageInBackup: row.include_image_in_backup !== undefined
|
||||
? Boolean(row.include_image_in_backup)
|
||||
: true, // Default to true
|
||||
appTemplateId: row.app_template_id ? String(row.app_template_id) : undefined,
|
||||
appTemplateVersion: row.app_template_version ? String(row.app_template_version) : undefined,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user