The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/server/startup/migrations/v291.ts

36 lines
1.0 KiB

import { Settings } from '@rocket.chat/models';
import type { IAppStorageItem } from '@rocket.chat/apps-engine/server/storage';
import type { AppRealStorage } from '../../../ee/server/apps/storage';
import { addMigration } from '../../lib/migrations';
import { Apps } from '../../../ee/server/apps';
addMigration({
version: 291,
name: "Mark all installed apps as 'migrated', add 'installationSource'",
async up() {
// remove non-used settings
await Settings.removeById('Apps_Framework_Development_Mode');
await Settings.removeById('Apps_Framework_enabled');
Apps.initialize();
const appsStorage = Apps.getStorage() as AppRealStorage;
const apps = await appsStorage.retrieveAll();
const promises: Array<ReturnType<AppRealStorage['update']>> = [];
apps.forEach((app) =>
promises.push(
appsStorage.update({
...app,
migrated: true,
installationSource: 'marketplaceInfo' in app ? 'marketplace' : 'private',
} as IAppStorageItem),
),
);
await Promise.all(promises);
},
});