Migration Importer
Bulk-import institution data from the 17-sheet migration template.
Overview
The migration tooling consists of:
institution_migration_template.sql— createsmigration.*staging tables (17 sheets)institution_migration_convert.sql— validates and inserts into live tablesCoreWave_Import_Template.xlsx— human-readable workbook for data collection
Prerequisites
- Institution must be pre-onboarded via the Admin portal (the migration does NOT create the institution)
- Base currency (e.g., NGN) must exist in
Currencies Interestsrows referenced by loan products must be seededpgcryptoextension must be available (staff password hashing)
Import Flow
- Generate the template:
python3 generate_import_template.py - Fill the workbook: Institution fills all 17 sheets
- Load to staging: Export each sheet to CSV,
\copyintomigration.*tables - Create staging tables:
psql -f institution_migration_template.sql - Run conversion:
psql -f institution_migration_convert.sql
Branch Code Mapping
The template uses migration-local branch codes. During sheet 2 import, a migration._branch_map is built (code → ID). All downstream sheets resolve branches through this map.
Export (Live → Template)
python3 export_institution_to_template.py \
--dump "institution_2_MyBank.sql" \
--template "CoreWave_Import_Template.xlsx" \
--out "CoreWave_Import_MyBank.xlsx" \
--institution-name "MyBank"