mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-22 01:25:00 +02:00
UBERF-7308: Upgrade model improvements (#5847)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
createDefaultSpace,
|
||||
createOrUpdate,
|
||||
tryMigrate,
|
||||
tryUpgrade,
|
||||
type MigrateOperation,
|
||||
type MigrationClient,
|
||||
type MigrationUpgradeClient
|
||||
@@ -293,15 +294,22 @@ export const documentsOperation: MigrateOperation = {
|
||||
}
|
||||
])
|
||||
},
|
||||
async upgrade (client: MigrationUpgradeClient): Promise<void> {
|
||||
const tx = new TxOperations(client, core.account.System)
|
||||
await createDefaultSpace(client, documents.space.Documents, { name: 'Documents', description: 'Documents' })
|
||||
await createQualityDocumentsSpace(tx)
|
||||
await createTemplatesSpace(tx)
|
||||
await createTemplateSequence(tx)
|
||||
await createTagCategories(tx)
|
||||
await createDocumentCategories(tx)
|
||||
await fixChangeControlsForDocs(tx)
|
||||
await createProductChangeControlTemplate(tx)
|
||||
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {
|
||||
await tryUpgrade(state, client, documentsId, [
|
||||
{
|
||||
state: 'init-documents',
|
||||
func: async (client) => {
|
||||
const tx = new TxOperations(client, core.account.System)
|
||||
await createDefaultSpace(client, documents.space.Documents, { name: 'Documents', description: 'Documents' })
|
||||
await createQualityDocumentsSpace(tx)
|
||||
await createTemplatesSpace(tx)
|
||||
await createTemplateSequence(tx)
|
||||
await createTagCategories(tx)
|
||||
await createDocumentCategories(tx)
|
||||
await fixChangeControlsForDocs(tx)
|
||||
await createProductChangeControlTemplate(tx)
|
||||
}
|
||||
}
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user