Fixes for mysql mirror db#1494
Conversation
…iffer The v2Mirror config and prepareV2Db() were appending '_v2' to the configured DB_NAME, causing connection failures when the MySQL user only had grants on the database name specified in config.yaml. Remove the suffix so the exact DB_NAME from config is used (matching V1 behavior). Add validation that V1 and V2 mirror DB names are different to prevent accidental data collision.
Extract validateMirrorDbNames() into a standalone exported function and add 17 tests covering: identical names throw, different names pass, and edge cases (null, undefined, empty, missing config sections).
Add OrganizationsV2Mirror model and wire up safeMirrorDbHandlerV2 calls in OrganizationsV2 create/bulkCreate/update/upsert/destroy so that organization data is mirrored to MySQL alongside all other V2 tables. Include organizations in the startup backfill. Also add a corrective migration to shorten two AEF index names that exceeded MySQL's 64-character identifier limit (ER_TOO_LONG_IDENT).
…ompat Update the original T5 and T2 AEF migrations to use explicit short index names for columns that exceed MySQL's 64-char identifier limit (authorization_date, incorporation_country, cooperative_approach_id). Wrap each addIndex in try/catch so partial re-runs from previous failures can complete the remaining indexes. Also update the corrective migration to handle incorporation_country and be idempotent on fresh installs.
Add OrganizationsV2Mirror assertions to smoke-models, v2-models-loading, and v2-models-import specs. Include organizations table in the backfill source table check. Add organizations to mysql-mirror-helpers TYPE_TO_TABLE and TYPE_TO_PRIMARY_KEY maps for live API mirror verification.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
Ignoring alerts on:
|
|
@SocketSecurity ignore npm/esbuild@0.25.12 |
The mysql-mirror-helpers.js test helper was appending '_v2' to the DB_NAME from config, but the CADT application uses DB_NAME as-is. This caused mirror verification to check an empty database instead of the one CADT actually writes to.
fix(V2): use correct mirror DB name in test verification helper
The mirror check task ensures mirrors exist for org_uid, registry_id, and data_model_version_store_id but was missing the file_store. When the initial mirror creation during org creation fails (e.g. wallet temporarily unsynced), the file_store mirror was never retried. Add file_store mirror creation to both V1 and V2 mirror check tasks so it is retried on the periodic schedule like all other stores.
fix: add file_store mirror to periodic mirror check
The delete-mirrors step fails when the wallet temporarily loses sync after on-chain transactions from the test suite. Add a pre-check that waits up to 5 minutes for wallet sync, then retry the deletion up to 3 times with 60-second waits between attempts for re-sync.
No description provided.