mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-11 01:40:32 +00:00
UBERF-9633: More proper fix (#8248)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
6f7175f100
commit
6b519bfb0e
@ -23,7 +23,6 @@ import {
|
|||||||
type MigrationDocumentQuery,
|
type MigrationDocumentQuery,
|
||||||
type MigrationIterator,
|
type MigrationIterator,
|
||||||
type MigrationUpgradeClient,
|
type MigrationUpgradeClient,
|
||||||
type MigrateMode,
|
|
||||||
tryMigrate
|
tryMigrate
|
||||||
} from '@hcengineering/model'
|
} from '@hcengineering/model'
|
||||||
import { htmlToMarkup } from '@hcengineering/text'
|
import { htmlToMarkup } from '@hcengineering/text'
|
||||||
@ -183,11 +182,8 @@ async function migrateActivityMarkup (client: MigrationClient): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const activityOperation: MigrateOperation = {
|
export const activityOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient, mode: MigrateMode): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(
|
await tryMigrate(mode, client, activityId, [
|
||||||
client,
|
|
||||||
activityId,
|
|
||||||
[
|
|
||||||
{
|
{
|
||||||
state: 'reactions',
|
state: 'reactions',
|
||||||
mode: 'upgrade',
|
mode: 'upgrade',
|
||||||
@ -234,9 +230,7 @@ export const activityOperation: MigrateOperation = {
|
|||||||
await client.move(DOMAIN_ACTIVITY, { _class: activity.class.UserMentionInfo }, DOMAIN_USER_MENTION)
|
await client.move(DOMAIN_ACTIVITY, { _class: activity.class.UserMentionInfo }, DOMAIN_USER_MENTION)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
])
|
||||||
mode
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {}
|
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {}
|
||||||
}
|
}
|
||||||
|
@ -13,24 +13,24 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
import aiBot, { aiBotId } from '@hcengineering/ai-bot'
|
||||||
import contact, { type Channel, type Person, type PersonAccount } from '@hcengineering/contact'
|
import contact, { type Channel, type Person, type PersonAccount } from '@hcengineering/contact'
|
||||||
import core, {
|
import core, {
|
||||||
DOMAIN_MODEL_TX,
|
DOMAIN_MODEL_TX,
|
||||||
|
TxProcessor,
|
||||||
|
type Domain,
|
||||||
|
type Ref,
|
||||||
type TxCUD,
|
type TxCUD,
|
||||||
type TxCreateDoc,
|
type TxCreateDoc,
|
||||||
type Ref,
|
type TxUpdateDoc
|
||||||
type TxUpdateDoc,
|
|
||||||
TxProcessor,
|
|
||||||
type Domain
|
|
||||||
} from '@hcengineering/core'
|
} from '@hcengineering/core'
|
||||||
import { DOMAIN_CHANNEL, DOMAIN_CONTACT } from '@hcengineering/model-contact'
|
|
||||||
import {
|
import {
|
||||||
tryMigrate,
|
tryMigrate,
|
||||||
type MigrateOperation,
|
type MigrateOperation,
|
||||||
type MigrationClient,
|
type MigrationClient,
|
||||||
type MigrationUpgradeClient
|
type MigrationUpgradeClient
|
||||||
} from '@hcengineering/model'
|
} from '@hcengineering/model'
|
||||||
import aiBot, { aiBotId } from '@hcengineering/ai-bot'
|
import { DOMAIN_CHANNEL, DOMAIN_CONTACT } from '@hcengineering/model-contact'
|
||||||
|
|
||||||
const DOMAIN_ACTIVITY = 'activity' as Domain
|
const DOMAIN_ACTIVITY = 'activity' as Domain
|
||||||
|
|
||||||
@ -74,8 +74,8 @@ async function migrateAiExtraAccounts (client: MigrationClient): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const aiBotOperation: MigrateOperation = {
|
export const aiBotOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, aiBotId, [
|
await tryMigrate(mode, client, aiBotId, [
|
||||||
{
|
{
|
||||||
state: 'remove-ai-bot-extra-accounts-v100',
|
state: 'remove-ai-bot-extra-accounts-v100',
|
||||||
func: migrateAiExtraAccounts
|
func: migrateAiExtraAccounts
|
||||||
|
@ -13,16 +13,16 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
import { analyticsCollectorId } from '@hcengineering/analytics-collector'
|
||||||
import {
|
import {
|
||||||
|
tryMigrate,
|
||||||
type MigrateOperation,
|
type MigrateOperation,
|
||||||
type MigrationClient,
|
type MigrationClient,
|
||||||
type MigrationUpgradeClient,
|
type MigrationUpgradeClient
|
||||||
tryMigrate
|
|
||||||
} from '@hcengineering/model'
|
} from '@hcengineering/model'
|
||||||
import { analyticsCollectorId } from '@hcengineering/analytics-collector'
|
import { DOMAIN_ACTIVITY } from '@hcengineering/model-activity'
|
||||||
import { DOMAIN_SPACE } from '@hcengineering/model-core'
|
import { DOMAIN_SPACE } from '@hcengineering/model-core'
|
||||||
import { DOMAIN_DOC_NOTIFY, DOMAIN_NOTIFICATION } from '@hcengineering/model-notification'
|
import { DOMAIN_DOC_NOTIFY, DOMAIN_NOTIFICATION } from '@hcengineering/model-notification'
|
||||||
import { DOMAIN_ACTIVITY } from '@hcengineering/model-activity'
|
|
||||||
|
|
||||||
async function removeOnboardingChannels (client: MigrationClient): Promise<void> {
|
async function removeOnboardingChannels (client: MigrationClient): Promise<void> {
|
||||||
const channels = await client.find(DOMAIN_SPACE, { 'analytics:mixin:AnalyticsChannel': { $exists: true } })
|
const channels = await client.find(DOMAIN_SPACE, { 'analytics:mixin:AnalyticsChannel': { $exists: true } })
|
||||||
@ -42,10 +42,11 @@ async function removeOnboardingChannels (client: MigrationClient): Promise<void>
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const analyticsCollectorOperation: MigrateOperation = {
|
export const analyticsCollectorOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, analyticsCollectorId, [
|
await tryMigrate(mode, client, analyticsCollectorId, [
|
||||||
{
|
{
|
||||||
state: 'remove-analytics-channels-v3',
|
state: 'remove-analytics-channels-v3',
|
||||||
|
mode: 'upgrade',
|
||||||
func: removeOnboardingChannels
|
func: removeOnboardingChannels
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -22,10 +22,11 @@ import {
|
|||||||
import attachment, { attachmentId, DOMAIN_ATTACHMENT } from '.'
|
import attachment, { attachmentId, DOMAIN_ATTACHMENT } from '.'
|
||||||
|
|
||||||
export const attachmentOperation: MigrateOperation = {
|
export const attachmentOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, attachmentId, [
|
await tryMigrate(mode, client, attachmentId, [
|
||||||
{
|
{
|
||||||
state: 'fix-attachedTo',
|
state: 'fix-attachedTo',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client: MigrationClient): Promise<void> => {
|
func: async (client: MigrationClient): Promise<void> => {
|
||||||
await client.update(
|
await client.update(
|
||||||
DOMAIN_ATTACHMENT,
|
DOMAIN_ATTACHMENT,
|
||||||
|
@ -25,8 +25,8 @@ import { bitrixId } from '@hcengineering/bitrix'
|
|||||||
|
|
||||||
export const bitrixOperation: MigrateOperation = {
|
export const bitrixOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {},
|
async migrate (client: MigrationClient): Promise<void> {},
|
||||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>, mode): Promise<void> {
|
||||||
await tryUpgrade(state, client, bitrixId, [
|
await tryUpgrade(mode, state, client, bitrixId, [
|
||||||
{
|
{
|
||||||
state: 'create-defaults-v2',
|
state: 'create-defaults-v2',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
|
@ -82,16 +82,17 @@ async function migrateIdentifiers (client: MigrationClient): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const boardOperation: MigrateOperation = {
|
export const boardOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, boardId, [
|
await tryMigrate(mode, client, boardId, [
|
||||||
{
|
{
|
||||||
state: 'identifier',
|
state: 'identifier',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateIdentifiers
|
func: migrateIdentifiers
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>, mode): Promise<void> {
|
||||||
await tryUpgrade(state, client, boardId, [
|
await tryUpgrade(mode, state, client, boardId, [
|
||||||
{
|
{
|
||||||
state: 'board0001',
|
state: 'board0001',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
|
@ -118,10 +118,11 @@ async function migrateTimezone (client: MigrationClient): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const calendarOperation: MigrateOperation = {
|
export const calendarOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, calendarId, [
|
await tryMigrate(mode, client, calendarId, [
|
||||||
{
|
{
|
||||||
state: 'calendar001',
|
state: 'calendar001',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await fixEventDueDate(client)
|
await fixEventDueDate(client)
|
||||||
await migrateReminders(client)
|
await migrateReminders(client)
|
||||||
@ -131,14 +132,17 @@ export const calendarOperation: MigrateOperation = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'timezone',
|
state: 'timezone',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateTimezone
|
func: migrateTimezone
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'migrate_calendars',
|
state: 'migrate_calendars',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateCalendars
|
func: migrateCalendars
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'move-events',
|
state: 'move-events',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await client.move(
|
await client.move(
|
||||||
DOMAIN_CALENDAR,
|
DOMAIN_CALENDAR,
|
||||||
@ -149,8 +153,8 @@ export const calendarOperation: MigrateOperation = {
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>, mode): Promise<void> {
|
||||||
await tryUpgrade(state, client, calendarId, [
|
await tryUpgrade(mode, state, client, calendarId, [
|
||||||
{
|
{
|
||||||
state: 'default-space',
|
state: 'default-space',
|
||||||
func: (client) =>
|
func: (client) =>
|
||||||
|
@ -13,16 +13,18 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
import { type DocUpdateMessage } from '@hcengineering/activity'
|
||||||
import { chunterId, type DirectMessage, type ThreadMessage } from '@hcengineering/chunter'
|
import { chunterId, type DirectMessage, type ThreadMessage } from '@hcengineering/chunter'
|
||||||
|
import contactPlugin, { type Person, type PersonAccount } from '@hcengineering/contact'
|
||||||
import core, {
|
import core, {
|
||||||
type Account,
|
DOMAIN_TX,
|
||||||
TxOperations,
|
TxOperations,
|
||||||
|
type Account,
|
||||||
type Class,
|
type Class,
|
||||||
type Doc,
|
type Doc,
|
||||||
type Domain,
|
type Domain,
|
||||||
type Ref,
|
type Ref,
|
||||||
type Space,
|
type Space
|
||||||
DOMAIN_TX
|
|
||||||
} from '@hcengineering/core'
|
} from '@hcengineering/core'
|
||||||
import {
|
import {
|
||||||
tryMigrate,
|
tryMigrate,
|
||||||
@ -31,15 +33,13 @@ import {
|
|||||||
type MigrationClient,
|
type MigrationClient,
|
||||||
type MigrationUpgradeClient
|
type MigrationUpgradeClient
|
||||||
} from '@hcengineering/model'
|
} from '@hcengineering/model'
|
||||||
import activity, { migrateMessagesSpace, DOMAIN_ACTIVITY } from '@hcengineering/model-activity'
|
import activity, { DOMAIN_ACTIVITY, migrateMessagesSpace } from '@hcengineering/model-activity'
|
||||||
import notification from '@hcengineering/notification'
|
|
||||||
import contactPlugin, { type Person, type PersonAccount } from '@hcengineering/contact'
|
|
||||||
import { DOMAIN_DOC_NOTIFY, DOMAIN_NOTIFICATION } from '@hcengineering/model-notification'
|
|
||||||
import { type DocUpdateMessage } from '@hcengineering/activity'
|
|
||||||
import { DOMAIN_SPACE } from '@hcengineering/model-core'
|
import { DOMAIN_SPACE } from '@hcengineering/model-core'
|
||||||
|
import { DOMAIN_DOC_NOTIFY, DOMAIN_NOTIFICATION } from '@hcengineering/model-notification'
|
||||||
|
import notification from '@hcengineering/notification'
|
||||||
|
|
||||||
import chunter from './plugin'
|
|
||||||
import { DOMAIN_CHUNTER } from './index'
|
import { DOMAIN_CHUNTER } from './index'
|
||||||
|
import chunter from './plugin'
|
||||||
|
|
||||||
export const DOMAIN_COMMENT = 'comment' as Domain
|
export const DOMAIN_COMMENT = 'comment' as Domain
|
||||||
|
|
||||||
@ -289,8 +289,8 @@ async function removeDuplicatedDirects (client: MigrationClient): Promise<void>
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const chunterOperation: MigrateOperation = {
|
export const chunterOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, chunterId, [
|
await tryMigrate(mode, client, chunterId, [
|
||||||
{
|
{
|
||||||
state: 'create-chat-messages',
|
state: 'create-chat-messages',
|
||||||
mode: 'upgrade',
|
mode: 'upgrade',
|
||||||
@ -374,8 +374,8 @@ export const chunterOperation: MigrateOperation = {
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>, mode): Promise<void> {
|
||||||
await tryUpgrade(state, client, chunterId, [
|
await tryUpgrade(mode, state, client, chunterId, [
|
||||||
{
|
{
|
||||||
state: 'create-defaults-v2',
|
state: 'create-defaults-v2',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
|
@ -184,10 +184,11 @@ async function mergePersonSpaces (client: MigrationClient): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const contactOperation: MigrateOperation = {
|
export const contactOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, contactId, [
|
await tryMigrate(mode, client, contactId, [
|
||||||
{
|
{
|
||||||
state: 'employees',
|
state: 'employees',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await client.update(
|
await client.update(
|
||||||
DOMAIN_TX,
|
DOMAIN_TX,
|
||||||
@ -296,6 +297,7 @@ export const contactOperation: MigrateOperation = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'removeEmployeeSpace',
|
state: 'removeEmployeeSpace',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await client.update(
|
await client.update(
|
||||||
DOMAIN_CONTACT,
|
DOMAIN_CONTACT,
|
||||||
@ -310,12 +312,14 @@ export const contactOperation: MigrateOperation = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'avatars',
|
state: 'avatars',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await migrateAvatars(client)
|
await migrateAvatars(client)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'avatarsKind',
|
state: 'avatarsKind',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await client.update(
|
await client.update(
|
||||||
DOMAIN_CONTACT,
|
DOMAIN_CONTACT,
|
||||||
@ -334,8 +338,8 @@ export const contactOperation: MigrateOperation = {
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>, mode): Promise<void> {
|
||||||
await tryUpgrade(state, client, contactId, [
|
await tryUpgrade(mode, state, client, contactId, [
|
||||||
{
|
{
|
||||||
state: 'createSpace-v2',
|
state: 'createSpace-v2',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
|
@ -459,8 +459,8 @@ async function migrateDocumentMetaInternalCode (client: MigrationClient): Promis
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const documentsOperation: MigrateOperation = {
|
export const documentsOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, documentsId, [
|
await tryMigrate(mode, client, documentsId, [
|
||||||
{
|
{
|
||||||
state: 'migrateSpaceTypes',
|
state: 'migrateSpaceTypes',
|
||||||
func: migrateSpaceTypes
|
func: migrateSpaceTypes
|
||||||
@ -490,8 +490,8 @@ export const documentsOperation: MigrateOperation = {
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>, mode): Promise<void> {
|
||||||
await tryUpgrade(state, client, documentsId, [
|
await tryUpgrade(mode, state, client, documentsId, [
|
||||||
{
|
{
|
||||||
state: 'init-documents',
|
state: 'init-documents',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
|
@ -396,8 +396,8 @@ async function processMigrateJsonForDoc (
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const coreOperation: MigrateOperation = {
|
export const coreOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, coreId, [
|
await tryMigrate(mode, client, coreId, [
|
||||||
{
|
{
|
||||||
state: 'statuses-to-model',
|
state: 'statuses-to-model',
|
||||||
mode: 'upgrade',
|
mode: 'upgrade',
|
||||||
@ -497,8 +497,8 @@ export const coreOperation: MigrateOperation = {
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>, mode): Promise<void> {
|
||||||
await tryUpgrade(state, client, coreId, [
|
await tryUpgrade(mode, state, client, coreId, [
|
||||||
{
|
{
|
||||||
state: 'create-defaults-v2',
|
state: 'create-defaults-v2',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
|
@ -314,8 +314,8 @@ async function removeOldClasses (client: MigrationClient): Promise<void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
export const documentOperation: MigrateOperation = {
|
export const documentOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, documentId, [
|
await tryMigrate(mode, client, documentId, [
|
||||||
{
|
{
|
||||||
state: 'updateDocumentIcons',
|
state: 'updateDocumentIcons',
|
||||||
mode: 'upgrade',
|
mode: 'upgrade',
|
||||||
|
@ -123,8 +123,8 @@ async function renameFields (client: MigrationClient): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const driveOperation: MigrateOperation = {
|
export const driveOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, driveId, [
|
await tryMigrate(mode, client, driveId, [
|
||||||
{
|
{
|
||||||
state: 'file-versions',
|
state: 'file-versions',
|
||||||
func: migrateFileVersions
|
func: migrateFileVersions
|
||||||
@ -136,7 +136,7 @@ export const driveOperation: MigrateOperation = {
|
|||||||
])
|
])
|
||||||
},
|
},
|
||||||
|
|
||||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>, mode): Promise<void> {
|
||||||
await tryUpgrade(state, client, driveId, [])
|
await tryUpgrade(mode, state, client, driveId, [])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,8 @@ async function migrateSettings (client: MigrationClient): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const gmailOperation: MigrateOperation = {
|
export const gmailOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, gmailId, [
|
await tryMigrate(mode, client, gmailId, [
|
||||||
{
|
{
|
||||||
state: 'removeDeprecatedSpace',
|
state: 'removeDeprecatedSpace',
|
||||||
func: async (client: MigrationClient) => {
|
func: async (client: MigrationClient) => {
|
||||||
|
@ -19,10 +19,11 @@ import core from '@hcengineering/model-core'
|
|||||||
import { GUEST_DOMAIN } from '.'
|
import { GUEST_DOMAIN } from '.'
|
||||||
|
|
||||||
export const guestOperation: MigrateOperation = {
|
export const guestOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, guestId, [
|
await tryMigrate(mode, client, guestId, [
|
||||||
{
|
{
|
||||||
state: 'migrateRoles',
|
state: 'migrateRoles',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
const stateMap = {
|
const stateMap = {
|
||||||
0: AccountRole.User,
|
0: AccountRole.User,
|
||||||
@ -67,6 +68,7 @@ export const guestOperation: MigrateOperation = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'removeDeprecatedSpace',
|
state: 'removeDeprecatedSpace',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client: MigrationClient) => {
|
func: async (client: MigrationClient) => {
|
||||||
await migrateSpace(client, 'guest:space:Links' as Ref<Space>, core.space.Workspace, [GUEST_DOMAIN])
|
await migrateSpace(client, 'guest:space:Links' as Ref<Space>, core.space.Workspace, [GUEST_DOMAIN])
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
import { type Space, TxOperations, type Ref } from '@hcengineering/core'
|
import { TxOperations, type Ref, type Space } from '@hcengineering/core'
|
||||||
import { type Department } from '@hcengineering/hr'
|
import { type Department } from '@hcengineering/hr'
|
||||||
import {
|
import {
|
||||||
migrateSpace,
|
migrateSpace,
|
||||||
@ -78,10 +78,11 @@ async function migrateDepartments (client: MigrationClient): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const hrOperation: MigrateOperation = {
|
export const hrOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, hrId, [
|
await tryMigrate(mode, client, hrId, [
|
||||||
{
|
{
|
||||||
state: 'migrateDepartments',
|
state: 'migrateDepartments',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateDepartments
|
func: migrateDepartments
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -92,8 +93,8 @@ export const hrOperation: MigrateOperation = {
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>, mode): Promise<void> {
|
||||||
await tryUpgrade(state, client, hrId, [
|
await tryUpgrade(mode, state, client, hrId, [
|
||||||
{
|
{
|
||||||
state: 'create-defaults-v2',
|
state: 'create-defaults-v2',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
|
@ -25,8 +25,8 @@ import {
|
|||||||
import { DOMAIN_INVENTORY } from '.'
|
import { DOMAIN_INVENTORY } from '.'
|
||||||
|
|
||||||
export const inventoryOperation: MigrateOperation = {
|
export const inventoryOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, inventoryId, [
|
await tryMigrate(mode, client, inventoryId, [
|
||||||
{
|
{
|
||||||
state: 'removeDeprecatedSpace',
|
state: 'removeDeprecatedSpace',
|
||||||
func: async (client: MigrationClient) => {
|
func: async (client: MigrationClient) => {
|
||||||
|
@ -168,18 +168,19 @@ async function migrateDefaultProjectOwners (client: MigrationClient): Promise<vo
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const leadOperation: MigrateOperation = {
|
export const leadOperation: MigrateOperation = {
|
||||||
async preMigrate (client: MigrationClient, logger: ModelLogger): Promise<void> {
|
async preMigrate (client: MigrationClient, logger: ModelLogger, mode): Promise<void> {
|
||||||
await tryMigrate(client, leadId, [
|
await tryMigrate(mode, client, leadId, [
|
||||||
{
|
{
|
||||||
state: 'migrate-default-statuses',
|
state: 'migrate-default-statuses',
|
||||||
func: (client) => migrateDefaultStatuses(client, logger)
|
func: (client) => migrateDefaultStatuses(client, logger)
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, leadId, [
|
await tryMigrate(mode, client, leadId, [
|
||||||
{
|
{
|
||||||
state: 'identifier',
|
state: 'identifier',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateIdentifiers
|
func: migrateIdentifiers
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -194,6 +195,7 @@ export const leadOperation: MigrateOperation = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'migrate-customer-description',
|
state: 'migrate-customer-description',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await client.update(
|
await client.update(
|
||||||
DOMAIN_CONTACT,
|
DOMAIN_CONTACT,
|
||||||
@ -210,8 +212,8 @@ export const leadOperation: MigrateOperation = {
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>, mode): Promise<void> {
|
||||||
await tryUpgrade(state, client, leadId, [
|
await tryUpgrade(mode, state, client, leadId, [
|
||||||
{
|
{
|
||||||
state: 'u-default-funnel',
|
state: 'u-default-funnel',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import contact from '@hcengineering/contact'
|
import contact from '@hcengineering/contact'
|
||||||
import { type Space, TxOperations, type Ref } from '@hcengineering/core'
|
import { TxOperations, type Ref, type Space } from '@hcengineering/core'
|
||||||
import drive from '@hcengineering/drive'
|
import drive from '@hcengineering/drive'
|
||||||
import {
|
import {
|
||||||
MeetingStatus,
|
MeetingStatus,
|
||||||
@ -35,8 +35,8 @@ import {
|
|||||||
type MigrationUpgradeClient
|
type MigrationUpgradeClient
|
||||||
} from '@hcengineering/model'
|
} from '@hcengineering/model'
|
||||||
import core from '@hcengineering/model-core'
|
import core from '@hcengineering/model-core'
|
||||||
import love from './plugin'
|
|
||||||
import { DOMAIN_LOVE, DOMAIN_MEETING_MINUTES } from '.'
|
import { DOMAIN_LOVE, DOMAIN_MEETING_MINUTES } from '.'
|
||||||
|
import love from './plugin'
|
||||||
|
|
||||||
async function createDefaultFloor (tx: TxOperations): Promise<void> {
|
async function createDefaultFloor (tx: TxOperations): Promise<void> {
|
||||||
const current = await tx.findOne(love.class.Floor, {
|
const current = await tx.findOne(love.class.Floor, {
|
||||||
@ -96,16 +96,18 @@ async function createReception (client: MigrationUpgradeClient): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const loveOperation: MigrateOperation = {
|
export const loveOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, loveId, [
|
await tryMigrate(mode, client, loveId, [
|
||||||
{
|
{
|
||||||
state: 'removeDeprecatedSpace',
|
state: 'removeDeprecatedSpace',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client: MigrationClient) => {
|
func: async (client: MigrationClient) => {
|
||||||
await migrateSpace(client, 'love:space:Rooms' as Ref<Space>, core.space.Workspace, [DOMAIN_LOVE])
|
await migrateSpace(client, 'love:space:Rooms' as Ref<Space>, core.space.Workspace, [DOMAIN_LOVE])
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'setup-defaults-settings-v2',
|
state: 'setup-defaults-settings-v2',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client: MigrationClient) => {
|
func: async (client: MigrationClient) => {
|
||||||
await client.update(
|
await client.update(
|
||||||
DOMAIN_LOVE,
|
DOMAIN_LOVE,
|
||||||
@ -151,12 +153,14 @@ export const loveOperation: MigrateOperation = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'move-meeting-minutes',
|
state: 'move-meeting-minutes',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await client.move(DOMAIN_LOVE, { _class: love.class.MeetingMinutes }, DOMAIN_MEETING_MINUTES)
|
await client.move(DOMAIN_LOVE, { _class: love.class.MeetingMinutes }, DOMAIN_MEETING_MINUTES)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'default-meeting-minutes-status',
|
state: 'default-meeting-minutes-status',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await client.update(
|
await client.update(
|
||||||
DOMAIN_MEETING_MINUTES,
|
DOMAIN_MEETING_MINUTES,
|
||||||
@ -167,8 +171,8 @@ export const loveOperation: MigrateOperation = {
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>, mode): Promise<void> {
|
||||||
await tryUpgrade(state, client, loveId, [
|
await tryUpgrade(mode, state, client, loveId, [
|
||||||
{
|
{
|
||||||
state: 'initial-defaults',
|
state: 'initial-defaults',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
|
@ -285,22 +285,25 @@ export async function migrateNotificationsObject (client: MigrationClient): Prom
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const notificationOperation: MigrateOperation = {
|
export const notificationOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, notificationId, [
|
await tryMigrate(mode, client, notificationId, [
|
||||||
{
|
{
|
||||||
state: 'delete-hidden-notifications',
|
state: 'delete-hidden-notifications',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await removeNotifications(client, { hidden: true })
|
await removeNotifications(client, { hidden: true })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'delete-invalid-notifications',
|
state: 'delete-invalid-notifications',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await removeNotifications(client, { attachedToClass: 'chunter:class:Comment' as Ref<Class<Doc>> })
|
await removeNotifications(client, { attachedToClass: 'chunter:class:Comment' as Ref<Class<Doc>> })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'remove-old-classes',
|
state: 'remove-old-classes',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await client.deleteMany(DOMAIN_NOTIFICATION, { _class: 'notification:class:DocUpdates' as Ref<Class<Doc>> })
|
await client.deleteMany(DOMAIN_NOTIFICATION, { _class: 'notification:class:DocUpdates' as Ref<Class<Doc>> })
|
||||||
await client.deleteMany(DOMAIN_TX, { objectClass: 'notification:class:DocUpdates' as Ref<Class<Doc>> })
|
await client.deleteMany(DOMAIN_TX, { objectClass: 'notification:class:DocUpdates' as Ref<Class<Doc>> })
|
||||||
@ -308,6 +311,7 @@ export const notificationOperation: MigrateOperation = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'removeDeprecatedSpace',
|
state: 'removeDeprecatedSpace',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client: MigrationClient) => {
|
func: async (client: MigrationClient) => {
|
||||||
await migrateSpace(client, 'notification:space:Notifications' as Ref<Space>, core.space.Workspace, [
|
await migrateSpace(client, 'notification:space:Notifications' as Ref<Space>, core.space.Workspace, [
|
||||||
DOMAIN_NOTIFICATION
|
DOMAIN_NOTIFICATION
|
||||||
@ -316,34 +320,40 @@ export const notificationOperation: MigrateOperation = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'migrate-setting',
|
state: 'migrate-setting',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateSettings
|
func: migrateSettings
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'move-doc-notify',
|
state: 'move-doc-notify',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await client.move(DOMAIN_NOTIFICATION, { _class: notification.class.DocNotifyContext }, DOMAIN_DOC_NOTIFY)
|
await client.move(DOMAIN_NOTIFICATION, { _class: notification.class.DocNotifyContext }, DOMAIN_DOC_NOTIFY)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'remove-last-view',
|
state: 'remove-last-view',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await client.deleteMany(DOMAIN_NOTIFICATION, { _class: 'notification:class:LastView' as any })
|
await client.deleteMany(DOMAIN_NOTIFICATION, { _class: 'notification:class:LastView' as any })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'remove-notification',
|
state: 'remove-notification',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await client.deleteMany(DOMAIN_NOTIFICATION, { _class: 'notification:class:Notification' as any })
|
await client.deleteMany(DOMAIN_NOTIFICATION, { _class: 'notification:class:Notification' as any })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'remove-email-notification',
|
state: 'remove-email-notification',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await client.deleteMany(DOMAIN_NOTIFICATION, { _class: 'notification:class:EmailNotification' as any })
|
await client.deleteMany(DOMAIN_NOTIFICATION, { _class: 'notification:class:EmailNotification' as any })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'move-user',
|
state: 'move-user',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await client.move(
|
await client.move(
|
||||||
DOMAIN_NOTIFICATION,
|
DOMAIN_NOTIFICATION,
|
||||||
@ -354,6 +364,7 @@ export const notificationOperation: MigrateOperation = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'fill-notification-archived-field-v1',
|
state: 'fill-notification-archived-field-v1',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await client.update<InboxNotification>(
|
await client.update<InboxNotification>(
|
||||||
DOMAIN_NOTIFICATION,
|
DOMAIN_NOTIFICATION,
|
||||||
@ -374,6 +385,7 @@ export const notificationOperation: MigrateOperation = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'fill-contexts-pinned-field-v1',
|
state: 'fill-contexts-pinned-field-v1',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await client.update<DocNotifyContext>(
|
await client.update<DocNotifyContext>(
|
||||||
DOMAIN_DOC_NOTIFY,
|
DOMAIN_DOC_NOTIFY,
|
||||||
@ -384,10 +396,12 @@ export const notificationOperation: MigrateOperation = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'migrate-notifications-space-v1',
|
state: 'migrate-notifications-space-v1',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateNotificationsSpace
|
func: migrateNotificationsSpace
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'migrate-employee-space-v1',
|
state: 'migrate-employee-space-v1',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async () => {
|
func: async () => {
|
||||||
await client.update<DocNotifyContext>(
|
await client.update<DocNotifyContext>(
|
||||||
DOMAIN_DOC_NOTIFY,
|
DOMAIN_DOC_NOTIFY,
|
||||||
@ -398,6 +412,7 @@ export const notificationOperation: MigrateOperation = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'migrate-wrong-spaces-v1',
|
state: 'migrate-wrong-spaces-v1',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async () => {
|
func: async () => {
|
||||||
await client.update<DocNotifyContext>(
|
await client.update<DocNotifyContext>(
|
||||||
DOMAIN_DOC_NOTIFY,
|
DOMAIN_DOC_NOTIFY,
|
||||||
@ -418,10 +433,12 @@ export const notificationOperation: MigrateOperation = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'migrate-duplicated-contexts-v3',
|
state: 'migrate-duplicated-contexts-v3',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateDuplicateContexts
|
func: migrateDuplicateContexts
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'set-default-hidden',
|
state: 'set-default-hidden',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async () => {
|
func: async () => {
|
||||||
await client.update(
|
await client.update(
|
||||||
DOMAIN_DOC_NOTIFY,
|
DOMAIN_DOC_NOTIFY,
|
||||||
@ -432,6 +449,7 @@ export const notificationOperation: MigrateOperation = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'remove-update-txes-docnotify-ctx-v2',
|
state: 'remove-update-txes-docnotify-ctx-v2',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await client.deleteMany(DOMAIN_TX, {
|
await client.deleteMany(DOMAIN_TX, {
|
||||||
_class: core.class.TxUpdateDoc,
|
_class: core.class.TxUpdateDoc,
|
||||||
@ -451,6 +469,7 @@ export const notificationOperation: MigrateOperation = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'remove-browser-notification-v2',
|
state: 'remove-browser-notification-v2',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await client.deleteMany<BrowserNotification>(DOMAIN_USER_NOTIFY, {
|
await client.deleteMany<BrowserNotification>(DOMAIN_USER_NOTIFY, {
|
||||||
_class: notification.class.BrowserNotification
|
_class: notification.class.BrowserNotification
|
||||||
@ -463,12 +482,14 @@ export const notificationOperation: MigrateOperation = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'migrate-dnc-space',
|
state: 'migrate-dnc-space',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await client.update(DOMAIN_DOC_NOTIFY, { space: core.space.Space }, { space: core.space.Workspace })
|
await client.update(DOMAIN_DOC_NOTIFY, { space: core.space.Space }, { space: core.space.Workspace })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'migrate-notifications-object',
|
state: 'migrate-notifications-object',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateNotificationsObject
|
func: migrateNotificationsObject
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -24,8 +24,8 @@ import {
|
|||||||
import { DOMAIN_PREFERENCE, preferenceId } from '@hcengineering/preference'
|
import { DOMAIN_PREFERENCE, preferenceId } from '@hcengineering/preference'
|
||||||
|
|
||||||
export const preferenceOperation: MigrateOperation = {
|
export const preferenceOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, preferenceId, [
|
await tryMigrate(mode, client, preferenceId, [
|
||||||
{
|
{
|
||||||
state: 'removeDeprecatedSpace',
|
state: 'removeDeprecatedSpace',
|
||||||
func: async (client: MigrationClient) => {
|
func: async (client: MigrationClient) => {
|
||||||
|
@ -43,18 +43,19 @@ import recruit from './plugin'
|
|||||||
import { defaultApplicantStatuses } from './spaceType'
|
import { defaultApplicantStatuses } from './spaceType'
|
||||||
|
|
||||||
export const recruitOperation: MigrateOperation = {
|
export const recruitOperation: MigrateOperation = {
|
||||||
async preMigrate (client: MigrationClient, logger: ModelLogger): Promise<void> {
|
async preMigrate (client: MigrationClient, logger: ModelLogger, mode): Promise<void> {
|
||||||
await tryMigrate(client, recruitId, [
|
await tryMigrate(mode, client, recruitId, [
|
||||||
{
|
{
|
||||||
state: 'migrate-default-statuses',
|
state: 'migrate-default-statuses',
|
||||||
func: (client) => migrateDefaultStatuses(client, logger)
|
func: (client) => migrateDefaultStatuses(client, logger)
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, recruitId, [
|
await tryMigrate(mode, client, recruitId, [
|
||||||
{
|
{
|
||||||
state: 'identifier',
|
state: 'identifier',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateIdentifiers
|
func: migrateIdentifiers
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -71,6 +72,7 @@ export const recruitOperation: MigrateOperation = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'migrate-applicants',
|
state: 'migrate-applicants',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client: MigrationClient) => {
|
func: async (client: MigrationClient) => {
|
||||||
await client.update(
|
await client.update(
|
||||||
DOMAIN_TASK,
|
DOMAIN_TASK,
|
||||||
@ -81,8 +83,8 @@ export const recruitOperation: MigrateOperation = {
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>, mode): Promise<void> {
|
||||||
await tryUpgrade(state, client, recruitId, [
|
await tryUpgrade(mode, state, client, recruitId, [
|
||||||
{
|
{
|
||||||
state: 'create-defaults-v2',
|
state: 'create-defaults-v2',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
|
@ -86,10 +86,11 @@ async function migrateRequestPersonAccounts (client: MigrationClient): Promise<v
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const requestOperation: MigrateOperation = {
|
export const requestOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, requestId, [
|
await tryMigrate(mode, client, requestId, [
|
||||||
{
|
{
|
||||||
state: 'migrateRequestPersonAccounts',
|
state: 'migrateRequestPersonAccounts',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateRequestPersonAccounts
|
func: migrateRequestPersonAccounts
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -32,7 +32,8 @@ import {
|
|||||||
type MigrateOperation,
|
type MigrateOperation,
|
||||||
type MigrationClient,
|
type MigrationClient,
|
||||||
type MigrationIterator,
|
type MigrationIterator,
|
||||||
type MigrationUpgradeClient
|
type MigrationUpgradeClient,
|
||||||
|
type MigrateMode
|
||||||
} from '@hcengineering/model'
|
} from '@hcengineering/model'
|
||||||
import { DOMAIN_ACTIVITY } from '@hcengineering/model-activity'
|
import { DOMAIN_ACTIVITY } from '@hcengineering/model-activity'
|
||||||
import {
|
import {
|
||||||
@ -263,8 +264,8 @@ async function createDocUpdateMessages (client: MigrationClient): Promise<void>
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const activityServerOperation: MigrateOperation = {
|
export const activityServerOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode: MigrateMode): Promise<void> {
|
||||||
await tryMigrate(client, serverActivityId, [
|
await tryMigrate(mode, client, serverActivityId, [
|
||||||
{
|
{
|
||||||
state: 'doc-update-messages',
|
state: 'doc-update-messages',
|
||||||
mode: 'upgrade',
|
mode: 'upgrade',
|
||||||
|
@ -25,8 +25,8 @@ import { settingId } from '@hcengineering/setting'
|
|||||||
import { DOMAIN_SETTING } from '.'
|
import { DOMAIN_SETTING } from '.'
|
||||||
|
|
||||||
export const settingOperation: MigrateOperation = {
|
export const settingOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, settingId, [
|
await tryMigrate(mode, client, settingId, [
|
||||||
{
|
{
|
||||||
state: 'removeDeprecatedSpace',
|
state: 'removeDeprecatedSpace',
|
||||||
func: async (client: MigrationClient) => {
|
func: async (client: MigrationClient) => {
|
||||||
|
@ -25,11 +25,11 @@ import {
|
|||||||
import survey, { surveyId } from './index'
|
import survey, { surveyId } from './index'
|
||||||
|
|
||||||
export const surveyOperation: MigrateOperation = {
|
export const surveyOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, surveyId, [])
|
await tryMigrate(mode, client, surveyId, [])
|
||||||
},
|
},
|
||||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>, mode): Promise<void> {
|
||||||
await tryUpgrade(state, client, surveyId, [
|
await tryUpgrade(mode, state, client, surveyId, [
|
||||||
{
|
{
|
||||||
state: 'createSpace',
|
state: 'createSpace',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
|
@ -10,8 +10,8 @@ import { tagsId } from '@hcengineering/tags'
|
|||||||
import { DOMAIN_TAGS } from '.'
|
import { DOMAIN_TAGS } from '.'
|
||||||
|
|
||||||
export const tagsOperation: MigrateOperation = {
|
export const tagsOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, tagsId, [
|
await tryMigrate(mode, client, tagsId, [
|
||||||
{
|
{
|
||||||
state: 'removeDeprecatedSpace',
|
state: 'removeDeprecatedSpace',
|
||||||
func: async (client: MigrationClient) => {
|
func: async (client: MigrationClient) => {
|
||||||
|
@ -541,10 +541,11 @@ function areSameArrays (arr1: any[] | undefined, arr2: any[] | undefined): boole
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const taskOperation: MigrateOperation = {
|
export const taskOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, taskId, [
|
await tryMigrate(mode, client, taskId, [
|
||||||
{
|
{
|
||||||
state: 'migrate-tt-model-states',
|
state: 'migrate-tt-model-states',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
const prTaskTypes = client.model.findAllSync(task.class.TaskType, {})
|
const prTaskTypes = client.model.findAllSync(task.class.TaskType, {})
|
||||||
|
|
||||||
@ -573,10 +574,12 @@ export const taskOperation: MigrateOperation = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'migrateRanks',
|
state: 'migrateRanks',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateRanks
|
func: migrateRanks
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'migrate_wrong_isdone',
|
state: 'migrate_wrong_isdone',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client: MigrationClient) => {
|
func: async (client: MigrationClient) => {
|
||||||
const statuses = client.model.findAllSync(core.class.Status, {
|
const statuses = client.model.findAllSync(core.class.Status, {
|
||||||
category: { $in: [task.statusCategory.Won, task.statusCategory.Lost] }
|
category: { $in: [task.statusCategory.Won, task.statusCategory.Lost] }
|
||||||
@ -608,6 +611,7 @@ export const taskOperation: MigrateOperation = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'migrateSequnce',
|
state: 'migrateSequnce',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client: MigrationClient) => {
|
func: async (client: MigrationClient) => {
|
||||||
await client.update(
|
await client.update(
|
||||||
'kanban' as Domain,
|
'kanban' as Domain,
|
||||||
@ -619,8 +623,8 @@ export const taskOperation: MigrateOperation = {
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>, mode): Promise<void> {
|
||||||
await tryUpgrade(state, client, taskId, [
|
await tryUpgrade(mode, state, client, taskId, [
|
||||||
{
|
{
|
||||||
state: 'u-task-001',
|
state: 'u-task-001',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
|
@ -25,8 +25,8 @@ import { telegramId } from '@hcengineering/telegram'
|
|||||||
import { DOMAIN_TELEGRAM } from '.'
|
import { DOMAIN_TELEGRAM } from '.'
|
||||||
|
|
||||||
export const telegramOperation: MigrateOperation = {
|
export const telegramOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, telegramId, [
|
await tryMigrate(mode, client, telegramId, [
|
||||||
{
|
{
|
||||||
state: 'removeDeprecatedSpace',
|
state: 'removeDeprecatedSpace',
|
||||||
func: async (client: MigrationClient) => {
|
func: async (client: MigrationClient) => {
|
||||||
|
@ -25,8 +25,8 @@ import { templatesId } from '@hcengineering/templates'
|
|||||||
|
|
||||||
export const templatesOperation: MigrateOperation = {
|
export const templatesOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {},
|
async migrate (client: MigrationClient): Promise<void> {},
|
||||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>, mode): Promise<void> {
|
||||||
await tryUpgrade(state, client, templatesId, [
|
await tryUpgrade(mode, state, client, templatesId, [
|
||||||
{
|
{
|
||||||
state: 'create-defaults',
|
state: 'create-defaults',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
|
@ -163,14 +163,16 @@ async function processFixMigrateMarkupFor (
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const textEditorOperation: MigrateOperation = {
|
export const textEditorOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, 'text-editor', [
|
await tryMigrate(mode, client, 'text-editor', [
|
||||||
{
|
{
|
||||||
state: 'markup',
|
state: 'markup',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateMarkup
|
func: migrateMarkup
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'fix-markup',
|
state: 'fix-markup',
|
||||||
|
mode: 'upgrade',
|
||||||
func: fixMigrateMarkup
|
func: fixMigrateMarkup
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -165,18 +165,19 @@ async function fillProps (client: MigrationClient): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const timeOperation: MigrateOperation = {
|
export const timeOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, timeId, [
|
await tryMigrate(mode, client, timeId, [
|
||||||
{
|
{
|
||||||
state: 'm-time-001',
|
state: 'm-time-001',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await fillProps(client)
|
await fillProps(client)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>, mode): Promise<void> {
|
||||||
await tryUpgrade(state, client, timeId, [
|
await tryUpgrade(mode, state, client, timeId, [
|
||||||
{
|
{
|
||||||
state: 'create-defaults-v2',
|
state: 'create-defaults-v2',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
|
@ -395,8 +395,8 @@ async function migrateIssueStatuses (client: MigrationClient): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const trackerOperation: MigrateOperation = {
|
export const trackerOperation: MigrateOperation = {
|
||||||
async preMigrate (client: MigrationClient, logger: ModelLogger): Promise<void> {
|
async preMigrate (client: MigrationClient, logger: ModelLogger, mode): Promise<void> {
|
||||||
await tryMigrate(client, trackerId, [
|
await tryMigrate(mode, client, trackerId, [
|
||||||
{
|
{
|
||||||
state: 'fixIncorrectIssueStatuses',
|
state: 'fixIncorrectIssueStatuses',
|
||||||
func: migrateIssueStatuses
|
func: migrateIssueStatuses
|
||||||
@ -407,32 +407,37 @@ export const trackerOperation: MigrateOperation = {
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, trackerId, [
|
await tryMigrate(mode, client, trackerId, [
|
||||||
{
|
{
|
||||||
state: 'identifier',
|
state: 'identifier',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateIdentifiers
|
func: migrateIdentifiers
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'passIdentifierToParentInfo',
|
state: 'passIdentifierToParentInfo',
|
||||||
|
mode: 'upgrade',
|
||||||
func: passIdentifierToParentInfo
|
func: passIdentifierToParentInfo
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'statusesToModel-2',
|
state: 'statusesToModel-2',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateStatusesToModel
|
func: migrateStatusesToModel
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'migrateDefaultTypeMixins',
|
state: 'migrateDefaultTypeMixins',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateDefaultTypeMixins
|
func: migrateDefaultTypeMixins
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'migrateDefaultProjectOwners',
|
state: 'migrateDefaultProjectOwners',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateDefaultProjectOwners
|
func: migrateDefaultProjectOwners
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>, mode): Promise<void> {
|
||||||
await tryUpgrade(state, client, trackerId, [
|
await tryUpgrade(mode, state, client, trackerId, [
|
||||||
{
|
{
|
||||||
state: 'create-defaults',
|
state: 'create-defaults',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
|
@ -26,10 +26,11 @@ import training, { trainingId } from '@hcengineering/training'
|
|||||||
import { DOMAIN_TRAINING } from './types'
|
import { DOMAIN_TRAINING } from './types'
|
||||||
|
|
||||||
export const trainingOperation: MigrateOperation = {
|
export const trainingOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, trainingId, [
|
await tryMigrate(mode, client, trainingId, [
|
||||||
{
|
{
|
||||||
state: 'migrateSequnce',
|
state: 'migrateSequnce',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client: MigrationClient) => {
|
func: async (client: MigrationClient) => {
|
||||||
await client.update(
|
await client.update(
|
||||||
DOMAIN_TRAINING,
|
DOMAIN_TRAINING,
|
||||||
@ -41,8 +42,8 @@ export const trainingOperation: MigrateOperation = {
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>, mode): Promise<void> {
|
||||||
await tryUpgrade(state, client, trainingId, [
|
await tryUpgrade(mode, state, client, trainingId, [
|
||||||
{
|
{
|
||||||
state: 'create-defaults',
|
state: 'create-defaults',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
|
@ -77,14 +77,16 @@ async function removeDoneStateFilter (client: MigrationClient): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const viewOperation: MigrateOperation = {
|
export const viewOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, viewId, [
|
await tryMigrate(mode, client, viewId, [
|
||||||
{
|
{
|
||||||
state: 'remove-done-state-pref',
|
state: 'remove-done-state-pref',
|
||||||
|
mode: 'upgrade',
|
||||||
func: removeDoneStatePref
|
func: removeDoneStatePref
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'remove-done-state-filter',
|
state: 'remove-done-state-filter',
|
||||||
|
mode: 'upgrade',
|
||||||
func: removeDoneStateFilter
|
func: removeDoneStateFilter
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -29,14 +29,16 @@ async function removeTabs (client: MigrationClient): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const workbenchOperation: MigrateOperation = {
|
export const workbenchOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, workbenchId, [
|
await tryMigrate(mode, client, workbenchId, [
|
||||||
{
|
{
|
||||||
state: 'remove-wrong-tabs-v1',
|
state: 'remove-wrong-tabs-v1',
|
||||||
|
mode: 'upgrade',
|
||||||
func: removeTabs
|
func: removeTabs
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'remove-txes-update-tabs-v1',
|
state: 'remove-txes-update-tabs-v1',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async () => {
|
func: async () => {
|
||||||
await client.deleteMany(DOMAIN_TX, {
|
await client.deleteMany(DOMAIN_TX, {
|
||||||
objectClass: workbench.class.WorkbenchTab,
|
objectClass: workbench.class.WorkbenchTab,
|
||||||
|
@ -163,10 +163,10 @@ export interface UpgradeOperations {
|
|||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export async function tryMigrate (
|
export async function tryMigrate (
|
||||||
|
mode: MigrateMode,
|
||||||
client: MigrationClient,
|
client: MigrationClient,
|
||||||
plugin: string,
|
plugin: string,
|
||||||
migrations: Migrations[],
|
migrations: Migrations[]
|
||||||
mode: MigrateMode = 'upgrade'
|
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const states = client.migrateState.get(plugin) ?? new Set()
|
const states = client.migrateState.get(plugin) ?? new Set()
|
||||||
for (const migration of migrations) {
|
for (const migration of migrations) {
|
||||||
@ -198,11 +198,11 @@ export async function tryMigrate (
|
|||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export async function tryUpgrade (
|
export async function tryUpgrade (
|
||||||
|
mode: MigrateMode,
|
||||||
state: Map<string, Set<string>>,
|
state: Map<string, Set<string>>,
|
||||||
client: () => Promise<MigrationUpgradeClient>,
|
client: () => Promise<MigrationUpgradeClient>,
|
||||||
plugin: string,
|
plugin: string,
|
||||||
migrations: UpgradeOperations[],
|
migrations: UpgradeOperations[]
|
||||||
mode: MigrateMode = 'upgrade'
|
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const states = state.get(plugin) ?? new Set()
|
const states = state.get(plugin) ?? new Set()
|
||||||
for (const upgrades of migrations) {
|
for (const upgrades of migrations) {
|
||||||
|
@ -330,7 +330,7 @@ export async function upgradeModel (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (updateIndexes === 'skip') {
|
if (updateIndexes === 'skip') {
|
||||||
await tryMigrate(migrateClient, coreId, [
|
await tryMigrate('upgrade', migrateClient, coreId, [
|
||||||
{
|
{
|
||||||
state: 'indexes-v5',
|
state: 'indexes-v5',
|
||||||
func: upgradeIndexes
|
func: upgradeIndexes
|
||||||
|
@ -127,20 +127,22 @@ async function migrateDocSyncInfo (client: MigrationClient): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const githubOperation: MigrateOperation = {
|
export const githubOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, githubId, [
|
await tryMigrate(mode, client, githubId, [
|
||||||
{
|
{
|
||||||
state: 'pull-requests',
|
state: 'pull-requests',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migratePullRequests
|
func: migratePullRequests
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'update-doc-sync-info',
|
state: 'update-doc-sync-info',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateDocSyncInfo
|
func: migrateDocSyncInfo
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>, mode): Promise<void> {
|
||||||
await tryUpgrade(state, client, githubId, [])
|
await tryUpgrade(mode, state, client, githubId, [])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,36 +303,43 @@ async function processMigrateMarkupFor (
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const githubOperationPreTime: MigrateOperation = {
|
export const githubOperationPreTime: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient, mode): Promise<void> {
|
||||||
await tryMigrate(client, githubId, [
|
await tryMigrate(mode, client, githubId, [
|
||||||
{
|
{
|
||||||
state: 'fix-todo-spaces',
|
state: 'fix-todo-spaces',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateTodoSpaces
|
func: migrateTodoSpaces
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'fix-missing-doc-sync-info',
|
state: 'fix-missing-doc-sync-info',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateFixMissingDocSyncInfo
|
func: migrateFixMissingDocSyncInfo
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'remove-github-components',
|
state: 'remove-github-components',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateRemoveGithubComponents
|
func: migrateRemoveGithubComponents
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'markup',
|
state: 'markup',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateMarkup
|
func: migrateMarkup
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'migrate-missing-states',
|
state: 'migrate-missing-states',
|
||||||
|
mode: 'upgrade',
|
||||||
func: migrateMissingStates
|
func: migrateMissingStates
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'remove-doc-sync-info-txes',
|
state: 'remove-doc-sync-info-txes',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await client.deleteMany(DOMAIN_TX, { objectClass: github.class.DocSyncInfo })
|
await client.deleteMany(DOMAIN_TX, { objectClass: github.class.DocSyncInfo })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
state: 'migrate-github-sync-domain',
|
state: 'migrate-github-sync-domain',
|
||||||
|
mode: 'upgrade',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
await client.move(DOMAIN_GITHUB, { _class: github.class.DocSyncInfo }, DOMAIN_GITHUB_SYNC, 100)
|
await client.move(DOMAIN_GITHUB, { _class: github.class.DocSyncInfo }, DOMAIN_GITHUB_SYNC, 100)
|
||||||
await client.move(DOMAIN_GITHUB, { _class: github.class.GithubUserInfo }, DOMAIN_GITHUB_USER)
|
await client.move(DOMAIN_GITHUB, { _class: github.class.GithubUserInfo }, DOMAIN_GITHUB_USER)
|
||||||
|
40
ws-tests/create-version-override.sh
Executable file
40
ws-tests/create-version-override.sh
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Define the target version
|
||||||
|
VERSION="$1"
|
||||||
|
|
||||||
|
# Path to docker-compose.yaml file
|
||||||
|
COMPOSE_FILE="./docker-compose.yaml"
|
||||||
|
OVERRIDE_FILE="./docker-compose.override.yml"
|
||||||
|
|
||||||
|
# Check if docker-compose file exists
|
||||||
|
if [ ! -f "$COMPOSE_FILE" ]; then
|
||||||
|
echo "Error: $COMPOSE_FILE not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create override file with header
|
||||||
|
echo "# Automatically generated docker-compose override with fixed versions" > $OVERRIDE_FILE
|
||||||
|
echo "services:" >> $OVERRIDE_FILE
|
||||||
|
|
||||||
|
# Extract hardcoreeng services and add them to the override file with fixed versions
|
||||||
|
grep -B 1 "image: hardcoreeng/" $COMPOSE_FILE | grep -v "\-\-" | grep -v "image:" | sed 's/:$//g' | while read -r service; do
|
||||||
|
service=$(echo $service | tr -d ' ')
|
||||||
|
if [ -n "$service" ]; then
|
||||||
|
echo " $service:" >> $OVERRIDE_FILE
|
||||||
|
|
||||||
|
# Get the image name
|
||||||
|
image=$(grep -A 1 "$service:" $COMPOSE_FILE | grep "image: hardcoreeng/" | awk '{print $2}')
|
||||||
|
pod_name=$(echo $image | sed 's/hardcoreeng\///')
|
||||||
|
|
||||||
|
echo " image: hardcoreeng/$pod_name:$VERSION" >> $OVERRIDE_FILE
|
||||||
|
if [ "$pod_name" == "account" ]; then
|
||||||
|
echo " environment:" >> $OVERRIDE_FILE
|
||||||
|
echo " - REGION_INFO=|;europe|Europe" >> $OVERRIDE_FILE
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Created $OVERRIDE_FILE with fixed version $VERSION for all hardcoreeng services"
|
||||||
|
echo "To use it, run: prepare.sh"
|
||||||
|
|
32
ws-tests/fetch-tool-bundle.sh
Executable file
32
ws-tests/fetch-tool-bundle.sh
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Define the path to the docker-compose.override.yml
|
||||||
|
DOCKER_COMPOSE_PATH="./docker-compose.override.yml"
|
||||||
|
|
||||||
|
# Extract the version of hardcoreeng/transactor from the docker-compose file
|
||||||
|
VERSION=$(grep "image: hardcoreeng/transactor:" "$DOCKER_COMPOSE_PATH" | head -1 | sed -E 's/.*image: hardcoreeng\/transactor:([^[:space:]]+).*/\1/')
|
||||||
|
|
||||||
|
if [ -z "$VERSION" ]; then
|
||||||
|
echo "Error: Could not find transactor version in docker-compose file"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Found transactor version: $VERSION"
|
||||||
|
echo "Fetching hardcoreeng/tool:$VERSION..."
|
||||||
|
|
||||||
|
# Pull the tool image with the same version
|
||||||
|
docker pull "hardcoreeng/tool:$VERSION"
|
||||||
|
|
||||||
|
# Create a temporary container from the image
|
||||||
|
CONTAINER_ID=$(docker container create "hardcoreeng/tool:$VERSION")
|
||||||
|
|
||||||
|
# Extract bundle.js from the container
|
||||||
|
echo "Extracting bundle.js..."
|
||||||
|
docker cp "$CONTAINER_ID:/usr/src/app/bundle.js" "bundle.js"
|
||||||
|
|
||||||
|
# Clean up the temporary container
|
||||||
|
docker rm "$CONTAINER_ID"
|
||||||
|
|
||||||
|
echo "Successfully extracted bundle.js to bundle.js"
|
@ -1,8 +1,18 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
docker compose -p sanity kill
|
|
||||||
docker compose -p sanity down --volumes
|
|
||||||
docker compose -p sanity up -d --force-recreate --renew-anon-volumes
|
# Check if docker-compose.override.yml exists
|
||||||
|
if [ -f "docker-compose.override.yml" ]; then
|
||||||
|
echo "Using docker-compose.override.yml"
|
||||||
|
docker compose -p sanity -f docker-compose.yaml -f docker-compose.override.yml kill
|
||||||
|
docker compose -p sanity -f docker-compose.yaml -f docker-compose.override.yml down --volumes
|
||||||
|
docker compose -p sanity -f docker-compose.yaml -f docker-compose.override.yml up -d --force-recreate --renew-anon-volumes
|
||||||
|
else
|
||||||
|
docker compose -p sanity kill
|
||||||
|
docker compose -p sanity down --volumes
|
||||||
|
docker compose -p sanity up -d --force-recreate --renew-anon-volumes
|
||||||
|
fi
|
||||||
docker_exit=$?
|
docker_exit=$?
|
||||||
if [ ${docker_exit} -eq 0 ]; then
|
if [ ${docker_exit} -eq 0 ]; then
|
||||||
echo "Container started successfully"
|
echo "Container started successfully"
|
||||||
|
40
ws-tests/pull-images.sh
Executable file
40
ws-tests/pull-images.sh
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Function to handle interrupt
|
||||||
|
handle_interrupt() {
|
||||||
|
echo -e "\nInterrupt received. Exiting..."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set trap for Ctrl+C (SIGINT)
|
||||||
|
trap handle_interrupt INT
|
||||||
|
|
||||||
|
# Path to docker-compose override file
|
||||||
|
OVERRIDE_FILE="./docker-compose.override.yml"
|
||||||
|
|
||||||
|
# Check if override file exists
|
||||||
|
if [ ! -f "$OVERRIDE_FILE" ]; then
|
||||||
|
echo "Error: $OVERRIDE_FILE not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Pulling images specified in $OVERRIDE_FILE..."
|
||||||
|
|
||||||
|
# Extract all images from the override file without using a pipe to a subshell
|
||||||
|
images=($(grep "image:" $OVERRIDE_FILE | awk '{print $2}'))
|
||||||
|
|
||||||
|
# Pull each image
|
||||||
|
for image in "${images[@]}"; do
|
||||||
|
if [ -n "$image" ]; then
|
||||||
|
echo "Pulling $image..."
|
||||||
|
docker pull $image 2>&1 | grep -v "What's next:" | grep -v "docker scout"
|
||||||
|
pull_status=${PIPESTATUS[0]}
|
||||||
|
if [ $pull_status -ne 0 ]; then
|
||||||
|
echo "Failed to pull $image"
|
||||||
|
else
|
||||||
|
echo "Successfully pulled $image"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "All images have been processed."
|
3
ws-tests/reset-version.sh
Executable file
3
ws-tests/reset-version.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
rm -rf ./docker-compose.override.yml
|
||||||
|
rm -rf ./bundle.js
|
@ -16,4 +16,10 @@ export DB_URL=postgresql://root@localhost:26258/defaultdb?sslmode=disable
|
|||||||
export REGION_INFO="|America;europe|" # Europe without name will not be available for creation of new workspaces.
|
export REGION_INFO="|America;europe|" # Europe without name will not be available for creation of new workspaces.
|
||||||
export TRANSACTOR_URL="ws://transactor:3334;ws://localhost:3334,ws://transactor-europe:3335;ws://localhost:3335;europe,"
|
export TRANSACTOR_URL="ws://transactor:3334;ws://localhost:3334,ws://transactor-europe:3335;ws://localhost:3335;europe,"
|
||||||
|
|
||||||
node ${TOOL_OPTIONS} --max-old-space-size=8096 ../dev/tool/bundle/bundle.js $@
|
# Check if local bundle.js exists and use it if available
|
||||||
|
BUNDLE_PATH="../dev/tool/bundle/bundle.js"
|
||||||
|
if [ -f "./bundle.js" ]; then
|
||||||
|
BUNDLE_PATH="./bundle.js"
|
||||||
|
fi
|
||||||
|
|
||||||
|
node ${TOOL_OPTIONS} --max-old-space-size=8096 $BUNDLE_PATH $@
|
@ -13,4 +13,10 @@ export ELASTIC_URL=http://localhost:9201
|
|||||||
export SERVER_SECRET=secret
|
export SERVER_SECRET=secret
|
||||||
export DB_URL=$MONGO_URL
|
export DB_URL=$MONGO_URL
|
||||||
|
|
||||||
node ${TOOL_OPTIONS} --max-old-space-size=8096 ../dev/tool/bundle/bundle.js $@
|
# Check if local bundle.js exists and use it if available
|
||||||
|
BUNDLE_PATH="../dev/tool/bundle/bundle.js"
|
||||||
|
if [ -f "./bundle.js" ]; then
|
||||||
|
BUNDLE_PATH="./bundle.js"
|
||||||
|
fi
|
||||||
|
|
||||||
|
node ${TOOL_OPTIONS} --max-old-space-size=8096 $BUNDLE_PATH $@
|
Loading…
Reference in New Issue
Block a user