UBERF-7308: Upgrade model improvements (#5847)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2024-06-18 18:02:41 +07:00
committed by GitHub
parent bb6f9d7645
commit b3db3024f3
35 changed files with 178 additions and 142 deletions
+18 -10
View File
@@ -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)
}
}
])
}
}