Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions backend/db/scripts/migrate_dynamo_to_postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@
_as_uuid(projectId / entityId) so FK lookups from donations/subscriptions
remain stable across re-runs.
- DynamoDB entity type quirk: SaveEntity rewrites 'general fund' → 'initiative'
before every PutItem. Migration reverses this:
if entityType == 'initiative' → restore to 'general fund'
before every PutItem. Migration reverses this and normalises to the canonical
underscore form used by the new backend:
if entityType == 'initiative' → 'general_fund'
- Budget.AmountInCents is serialised with json tag "amount" — access as
budget.get("amount"), NOT budget.get("amountInCents").
- Excluded from schema (no DynamoDB write path / computed at read-time):
Expand Down Expand Up @@ -723,10 +724,11 @@ def migrate_initiatives(cur, entities: list, projects: list, known_users: set, u
known_initiative_ids.add(pg_id)

# entityType quirk: SaveEntity rewrites 'general fund' → 'initiative'
# before every PutItem. Reverse it here.
# before every PutItem. Reverse it here and normalise to the canonical
# underscore form used by ValidInitiativeTypes in the new backend.
entity_type: str = e.get("entityType") or ""
if entity_type == "initiative":
entity_type = "general fund"
entity_type = "general_fund"
Comment thread
mlehotskylf marked this conversation as resolved.

# ── Core initiative row ──────────────────────────────────────────
initiative_rows.append(
Expand Down
Loading