Browse Source

refactor: migration name

pull/9499/head
Pranav C 2 months ago
parent
commit
699b7dda71
  1. 8
      packages/nocodb/src/meta/migrations/XcMigrationSourcev2.ts
  2. 0
      packages/nocodb/src/meta/migrations/v2/nc_064_encrypt_flag.ts
  3. 13
      packages/nocodb/src/version-upgrader/upgraders/0225002_ncDatasourceDecrypt.ts

8
packages/nocodb/src/meta/migrations/XcMigrationSourcev2.ts

@ -51,7 +51,7 @@ import * as nc_061_integration_is_default from '~/meta/migrations/v2/nc_061_inte
import * as nc_062_integration_store from '~/meta/migrations/v2/nc_062_integration_store'; import * as nc_062_integration_store from '~/meta/migrations/v2/nc_062_integration_store';
import * as nc_063_form_field_filter from '~/meta/migrations/v2/nc_063_form_field_filter'; import * as nc_063_form_field_filter from '~/meta/migrations/v2/nc_063_form_field_filter';
import * as nc_064_pg_minimal_dbs from '~/meta/migrations/v2/nc_064_pg_minimal_dbs'; import * as nc_064_pg_minimal_dbs from '~/meta/migrations/v2/nc_064_pg_minimal_dbs';
import * as nc_063_encrypt_flag from '~/meta/migrations/v2/nc_061_encrypt_flag'; import * as nc_064_encrypt_flag from '~/meta/migrations/v2/nc_064_encrypt_flag';
// Create a custom migration source class // Create a custom migration source class
export default class XcMigrationSourcev2 { export default class XcMigrationSourcev2 {
@ -114,7 +114,7 @@ export default class XcMigrationSourcev2 {
'nc_062_integration_store', 'nc_062_integration_store',
'nc_063_form_field_filter', 'nc_063_form_field_filter',
'nc_064_pg_minimal_dbs', 'nc_064_pg_minimal_dbs',
'nc_063_encrypt_flag', 'nc_064_encrypt_flag',
]); ]);
} }
@ -230,8 +230,8 @@ export default class XcMigrationSourcev2 {
return nc_063_form_field_filter; return nc_063_form_field_filter;
case 'nc_064_pg_minimal_dbs': case 'nc_064_pg_minimal_dbs':
return nc_064_pg_minimal_dbs; return nc_064_pg_minimal_dbs;
case 'nc_063_encrypt_flag': case 'nc_064_encrypt_flag':
return nc_063_encrypt_flag; return nc_064_encrypt_flag;
} }
} }
} }

0
packages/nocodb/src/meta/migrations/v2/nc_063_encrypt_flag.ts → packages/nocodb/src/meta/migrations/v2/nc_064_encrypt_flag.ts

13
packages/nocodb/src/version-upgrader/upgraders/0225002_ncDatasourceDecrypt.ts

@ -1,3 +1,4 @@
import process from 'process';
import CryptoJS from 'crypto-js'; import CryptoJS from 'crypto-js';
import type { NcUpgraderCtx } from '~/version-upgrader/NcUpgrader'; import type { NcUpgraderCtx } from '~/version-upgrader/NcUpgrader';
import Noco from '~/Noco'; import Noco from '~/Noco';
@ -30,6 +31,14 @@ export default async function ({ ncMeta }: NcUpgraderCtx) {
)?.value; )?.value;
} }
// if encryption key is same as previous, return
if (
process.env.NC_KEY_CREDENTIAL_ENCRYPT &&
process.env.NC_KEY_CREDENTIAL_ENCRYPT === encryptionKey
) {
return;
}
// if encryption key is not present, return // if encryption key is not present, return
if (!encryptionKey) { if (!encryptionKey) {
return; return;
@ -86,7 +95,9 @@ export default async function ({ ncMeta }: NcUpgraderCtx) {
// if all failed, log and exit // if all failed, log and exit
if (passed.length > 0 && passed.every((v) => !v)) { if (passed.length > 0 && passed.every((v) => !v)) {
logger.error(`Failed to decrypt all source or integration. Please configure correct encryption key. `); logger.error(
`Failed to decrypt all source or integration. Please configure correct encryption key. `,
);
return; return;
} }

Loading…
Cancel
Save