@sap/cds-mtxs
Advanced tools
Comparing version 1.7.2 to 1.7.3
@@ -82,5 +82,6 @@ #!/usr/bin/env node | ||
const force = options.includes('--force') | ||
run(tenants, { directory, dry, force, tag, tagRule, cleanup }).catch(console.error) | ||
const skipVerification = options.includes('--skip-verification') | ||
run(tenants, { directory, dry, force, tag, tagRule, "skip-verification": skipVerification, cleanup }).catch(console.error) | ||
} else { | ||
module.exports.run = run | ||
} |
@@ -122,3 +122,3 @@ const path = require('path') | ||
const { directory, dry, force, tagRule: tagRegex, tag: defaultTag } = options | ||
const { directory, dry, force, tagRule: tagRegex, tag: defaultTag, "skip-verification": skipVerification } = options | ||
@@ -206,8 +206,12 @@ const migrationResult = new MigrationResult() | ||
// Verify migrated extension | ||
try { | ||
await _verifyExtension(tenantProjectFolder, tenant) | ||
migrationResult.log(tenant, `Extension verification successful for tenant ${tenant}`) | ||
} catch (error) { | ||
migrationResult.error(tenant, `Extension verification failed for tenant ${tenant}, skipping migration`, error) | ||
continue | ||
if (!skipVerification) { | ||
try { | ||
await _verifyExtension(tenantProjectFolder, tenant) | ||
migrationResult.log(tenant, `Extension verification successful for tenant ${tenant}`) | ||
} catch (error) { | ||
migrationResult.error(tenant, `Extension verification failed for tenant ${tenant}, skipping migration`, error) | ||
continue | ||
} | ||
} else { | ||
migrationResult.log(tenant, `Extension verification skipped for tenant ${tenant}`) | ||
} | ||
@@ -214,0 +218,0 @@ |
@@ -143,2 +143,17 @@ const cds = require('@sap/cds') | ||
module.exports.verifyMigration = async (tenant) => { | ||
if (!module.exports.wasOldMtx()) return true | ||
return module.exports.isMigrated(tenant) | ||
} | ||
module.exports.wasOldMtx = async () => { | ||
const hana = require('@sap/cds-mtxs/srv/plugins/hana/srv-mgr') | ||
try { | ||
return !!(await hana.get('__META__')) | ||
} catch (error) { | ||
if (error.status === 404) return false | ||
else throw e | ||
} | ||
} | ||
module.exports.isMigrated = async (tenant) => { | ||
@@ -145,0 +160,0 @@ return getMetadata(tenant, 'migrated') |
{ | ||
"name": "@sap/cds-mtxs", | ||
"version": "1.7.2", | ||
"version": "1.7.3", | ||
"description": "SAP Cloud Application Programming Model - Multitenancy library", | ||
@@ -5,0 +5,0 @@ "homepage": "https://cap.cloud.sap/", |
@@ -115,5 +115,5 @@ const cds = require('@sap/cds/lib') | ||
const ds = await cds.connect.to(DeploymentService) | ||
const tx = await ds.tx(cds.context) | ||
await this.limiter(clusterSize, dbToTenants, tenants => | ||
this.limiter(workerSize ?? poolSize, Array.from(tenants), t => tx.upgrade(t)) | ||
this.limiter(workerSize ?? poolSize, Array.from(tenants), t => ds.tx({tenant:t}, tx => tx.upgrade(t))) | ||
) | ||
@@ -120,0 +120,0 @@ await this._sendCallback('SUCCEEDED', 'Tenant upgrade succeeded') |
@@ -147,3 +147,8 @@ const cds = require('@sap/cds/lib'), {db} = cds.env.requires | ||
function _isExtensible() { | ||
return cds.requires.extensibility || cds.requires['cds.xt.ExtensibilityService'] | ||
} | ||
async function _readExtCsvs(tenant) { | ||
if (!_isExtensible()) return | ||
const { 'cds.xt.ModelProviderService': mp } = cds.services | ||
@@ -230,3 +235,3 @@ const extensions = await mp.getExtResources(tenant) | ||
// FIXME: Do that check in a better way, as ExtensibilityService is always on by new sidecar presets | ||
const isExtensible = cds.requires.extensibility || cds.requires['cds.xt.ExtensibilityService'] | ||
const isExtensible = _isExtensible() | ||
if (isExtensible || tenant === t0) { | ||
@@ -233,0 +238,0 @@ const csn = await _csn |
178569
3731