Appearance
Shares Hybrid DB Rollout Checklist
Audit date: June 11, 2026
This checklist captures the exact gap between:
- local backend source of truth in
pinkapple-advance - deployed runtime routes on staging
- deployed database objects on
stat-solutions-networkDbX
Summary
As of June 11, 2026:
- share workflow integration is already deployed on the live database
- share import, share catch-up, share reconciliation, and hybrid distribution HTTP routes are mounted on the deployed staging runtime
- the hybrid share plus deposit distribution database tranche is still missing on the live database
That means the main remaining deployment work is the hybrid database rollout, not the route wiring.
Local Source Of Truth
The missing live objects already exist locally in pinkapple-advance.
Primary source files:
/home/usamaidrsk/dev/stat-solutions/pinkapple-advance/shared/DB/tables/dividend__tables.sql/home/usamaidrsk/dev/stat-solutions/pinkapple-advance/shared/DB/procedures/dividend_procedures.sql/home/usamaidrsk/dev/stat-solutions/pinkapple-advance/shared/DB/seeds/share-flag-catalog.yaml/home/usamaidrsk/dev/stat-solutions/pinkapple-advance/shared/DB/seeds/share-type-default-flag-profile.yaml/home/usamaidrsk/dev/stat-solutions/pinkapple-advance/shared/DB/seeds/permissions.yaml
Relevant local runtime files:
/home/usamaidrsk/dev/stat-solutions/pinkapple-advance/app.ts/home/usamaidrsk/dev/stat-solutions/pinkapple-advance/business/shares/import/routes.ts/home/usamaidrsk/dev/stat-solutions/pinkapple-advance/business/shares/import/services/share-import.service.ts/home/usamaidrsk/dev/stat-solutions/pinkapple-advance/business/migration/routes.ts/home/usamaidrsk/dev/stat-solutions/pinkapple-advance/business/migration/services/migration-catchup.service.ts/home/usamaidrsk/dev/stat-solutions/pinkapple-advance/business/migration/services/migration-reconciliation.service.ts
What Is Already Live
Workflow DB Objects
The following workflow templates are already present on the live database:
SHARE.ACCOUNT.ONBOARDINGSHARE.WITHDRAWAL.REQUESTSHARE.DIVIDEND.EVENT
Observed live workflow counts:
SHARE.ACCOUNT.ONBOARDING: 6 stages, 5 transitionsSHARE.WITHDRAWAL.REQUEST: 6 stages, 5 transitionsSHARE.DIVIDEND.EVENT: 7 stages, 6 transitions
Observed live workflow instance usage:
SHARE_ACCOUNT: 1 instanceDIVIDEND_EVENT: 2 instancesSHARE_WITHDRAWAL_REQUEST: 0 instances
Workflow State Exposure
The live retrieval procedures already expose workflow fields:
get_share_accountsget_share_withdrawal_requestsget_dividend_events
Migration Runtime Prerequisites
The live database already contains:
IMPORT_SHARE_ACCOUNTSMIGRATION_OPENING_BALANCE_CONTRA
Deployed Runtime Routes
The following staging endpoints returned 401 Unauthorized rather than 404, which confirms the routes are mounted:
POST /api/shares/import/templatePOST /api/migration/catchup/share/validateGET /api/migration/reconciliation/sharesGET /api/shares/operations/dividends/member-distribution-runs
What Is Still Missing On The Live DB
1. Hybrid Table DDL
Missing hybrid tables:
member_distribution_policymember_distribution_runmember_distribution_segmentmember_distribution_allocation
These are defined locally in:
shared/DB/tables/dividend__tables.sqlat themember_distribution_*table section
The same local file also extends dividend_event.calculation_basis to include:
HYBRID_SHARE_DEPOSIT_DAYS
See:
shared/DB/tables/dividend__tables.sqlat thedividend_event.calculation_basisdefinition
2. Hybrid Procedures
Missing hybrid procedures:
get_member_distribution_policiesupsert_member_distribution_policysync_member_distribution_run_to_dividend_allocationscreate_member_distribution_runget_member_distribution_runsget_member_distribution_run_allocationsget_member_distribution_run_segmentspost_member_distribution_run
These are defined locally in:
shared/DB/procedures/dividend_procedures.sqlat the member distribution procedure section
3. Updated Dividend Procedures
The live DB still has the older dividend procedures. It does not yet contain hybrid-aware logic inside:
declare_dividend_eventget_dividend_eventscalculate_dividend_allocationsprocess_dividend_payments
The local hybrid-aware versions are in:
shared/DB/procedures/dividend_procedures.sqlat the hybrid-aware dividend procedure section
4. Share Flag Catalog Update
Live DIVIDEND_COMPUTATION_METHOD still stops at HYBRID.
It must include:
HYBRID_SHARE_DEPOSIT_DAYS
Local source:
shared/DB/seeds/share-flag-catalog.yamlat theDIVIDEND_COMPUTATION_METHODflag entry
5. Share Type Default Profile Update
Live PREFERENCE_SHARES / PREFERENCE_PARTICIPATING still defaults to:
"HYBRID"
It must be updated to:
"HYBRID_SHARE_DEPOSIT_DAYS"
Local source:
shared/DB/seeds/share-type-default-flag-profile.yamlat thePREFERENCE_SHARES / PREFERENCE_PARTICIPATINGdefault entry
6. Hybrid Permissions
Missing live permissions:
VIEW_MEMBER_DISTRIBUTION_POLICYMANAGE_MEMBER_DISTRIBUTION_POLICYVIEW_MEMBER_DISTRIBUTION_RUNCREATE_MEMBER_DISTRIBUTION_RUNPOST_MEMBER_DISTRIBUTION_RUN
Local source:
shared/DB/seeds/permissions.yamlat the member distribution permission entries
Recommended Deployment Order
Apply in this order:
- Back up the live database objects related to dividends and permissions.
- Apply table DDL from
dividend__tables.sql. - Refresh dividend procedures from
dividend_procedures.sql. - Apply seed updates for:
share_flag_catalogshare_type_default_flag_profilepermission
- Regenerate or reapply any permission cache / auth bootstrap layer if your deployment process uses one.
- Run the verification SQL below.
- Smoke test the hybrid runtime endpoints with an authenticated request.
Verification SQL
A. Hybrid Table Presence
sql
SELECT TABLE_NAME
FROM information_schema.tables
WHERE table_schema = 'stat-solutions-networkDbX'
AND TABLE_NAME IN (
'member_distribution_policy',
'member_distribution_run',
'member_distribution_segment',
'member_distribution_allocation'
)
ORDER BY TABLE_NAME;Expected: 4 rows.
B. Hybrid Procedure Presence
sql
SELECT ROUTINE_NAME
FROM information_schema.routines
WHERE routine_schema = 'stat-solutions-networkDbX'
AND ROUTINE_NAME IN (
'get_member_distribution_policies',
'upsert_member_distribution_policy',
'sync_member_distribution_run_to_dividend_allocations',
'create_member_distribution_run',
'get_member_distribution_runs',
'get_member_distribution_run_allocations',
'get_member_distribution_run_segments',
'post_member_distribution_run'
)
ORDER BY ROUTINE_NAME;Expected: 8 rows.
C. Dividend Event Calculation Basis
sql
SELECT COLUMN_TYPE
FROM information_schema.columns
WHERE table_schema = 'stat-solutions-networkDbX'
AND table_name = 'dividend_event'
AND column_name = 'calculation_basis';Expected: includes HYBRID_SHARE_DEPOSIT_DAYS.
D. Dividend Computation Method Seed
sql
SELECT flag_code, allowed_values_json
FROM share_flag_catalog
WHERE flag_code = 'DIVIDEND_COMPUTATION_METHOD';Expected: allowed_values_json includes HYBRID_SHARE_DEPOSIT_DAYS.
E. Participating Preference Share Default
sql
SELECT profile.product_group, profile.product_type, profile.flag_value_json
FROM share_type_default_flag_profile profile
JOIN share_flag_catalog flag
ON flag.share_flag_id = profile.share_flag_id
WHERE flag.flag_code = 'DIVIDEND_COMPUTATION_METHOD'
AND profile.product_group = 'PREFERENCE_SHARES'
AND profile.product_type = 'PREFERENCE_PARTICIPATING';Expected: flag_value_json = "HYBRID_SHARE_DEPOSIT_DAYS".
F. Hybrid Permission Rows
sql
SELECT permissions_name
FROM permission
WHERE permissions_name IN (
'VIEW_MEMBER_DISTRIBUTION_POLICY',
'MANAGE_MEMBER_DISTRIBUTION_POLICY',
'VIEW_MEMBER_DISTRIBUTION_RUN',
'CREATE_MEMBER_DISTRIBUTION_RUN',
'POST_MEMBER_DISTRIBUTION_RUN'
)
ORDER BY permissions_name;Expected: 5 rows.
G. Workflow Templates Still Present
sql
SELECT template_code, template_name, status, version
FROM workflow_template
WHERE template_code IN (
'SHARE.ACCOUNT.ONBOARDING',
'SHARE.WITHDRAWAL.REQUEST',
'SHARE.DIVIDEND.EVENT'
)
ORDER BY template_code;Expected: 3 rows, all ACTIVE.
H. Runtime Prerequisites For Share Import
sql
SELECT permissions_name
FROM permission
WHERE permissions_name = 'IMPORT_SHARE_ACCOUNTS';
SELECT tag_key
FROM sys_tag
WHERE tag_key = 'MIGRATION_OPENING_BALANCE_CONTRA';Expected: both rows exist.
Runtime Smoke Checks
The staging runtime already proved the routes are mounted by returning 401 without auth. After DB deployment, run the same probes with a valid token and company alias:
bash
curl -i -X POST https://app.staging.pinkapple-erp.com/api/shares/import/template
curl -i -X POST https://app.staging.pinkapple-erp.com/api/migration/catchup/share/validate
curl -i https://app.staging.pinkapple-erp.com/api/migration/reconciliation/shares
curl -i https://app.staging.pinkapple-erp.com/api/shares/operations/dividends/member-distribution-runsExpected after authentication:
- no
404 - no SQL object missing errors
- hybrid distribution endpoints should proceed to normal auth and business validation
Important Interpretation
The current drift is not “feature absent everywhere.”
The actual state is:
- routes are deployed
- workflow DB objects are deployed
- hybrid DB objects are not deployed
So the highest-priority remaining item is the hybrid database rollout, not another frontend or route registration change.
