mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-13 11:23:50 +00:00
V3 project migration (#1652)
* migrate settings * migrate viewsettings * migrate url preset * migrate project data * migrate custom fields * migrate automations * migrate rundown * lint * return custom field translation table * check regex * new url type * refactor * migrate old OSC subscriptions * migrate old http subscriptions * update comments * migrate the whole db * remove automation logging unlis there is an error * return a new object * refactor: copy currup is only used in one place * make a copy of original migrated file * refactor: ensure image flder is part of project service init * add entrys to groups * small cleanup * just drop incorrect custom fields in the default data parser
This commit is contained in:
committed by
GitHub
parent
35347e8d63
commit
9ebb3decdb
@@ -3,36 +3,7 @@ import { DatabaseModel, AutomationSettings, NormalisedAutomation, Trigger } from
|
||||
import { dbModel } from '../../models/dataModel.js';
|
||||
import type { ErrorEmitter } from '../../utils/parserUtils.js';
|
||||
|
||||
interface LegacyData extends Partial<DatabaseModel> {
|
||||
http?: unknown;
|
||||
osc?: {
|
||||
enabledIn?: boolean;
|
||||
portIn?: number;
|
||||
};
|
||||
}
|
||||
|
||||
export function parseAutomationSettings(data: LegacyData, emitError?: ErrorEmitter): AutomationSettings {
|
||||
// TODO(v4): move to migration script
|
||||
/**
|
||||
* Leaving a path for migrating users to the new automations
|
||||
* This should be removed after a few releases
|
||||
*/
|
||||
if (data.http || data.osc) {
|
||||
emitError?.('Found legacy integrations');
|
||||
console.log('Found legacy integrations...');
|
||||
if (data.osc) {
|
||||
return {
|
||||
enabledAutomations: dbModel.automation.enabledAutomations,
|
||||
enabledOscIn: data.osc?.enabledIn ?? dbModel.automation.enabledOscIn,
|
||||
oscPortIn: data.osc?.portIn ?? dbModel.automation.oscPortIn,
|
||||
triggers: [],
|
||||
automations: {},
|
||||
};
|
||||
} else {
|
||||
return { ...dbModel.automation };
|
||||
}
|
||||
}
|
||||
|
||||
export function parseAutomationSettings(data: Partial<DatabaseModel>, emitError?: ErrorEmitter): AutomationSettings {
|
||||
if (!data.automation) {
|
||||
emitError?.('No data found to import');
|
||||
return { ...dbModel.automation };
|
||||
|
||||
Reference in New Issue
Block a user