Data Migration Plan
So the plan is to move from the DynamoDB to Postgres for the backend and RxDB to handle the offline capabilities. Below is the ultimate plan – all of which has to be done.
1. Schema Mapping
- Document current DynamoDB items.
- Identify relational structures.
- Design PostgreSQL schema accordingly.
- Identify all metadata fields to migrate.
- Keep binary content in DynamoDB/S3.
Deliverable: Postgres ERD
2. Build Postgres & GraphQL Layer
- Deploy Postgres instance
- Build migrations
- Build GraphQL resolvers
- Add delta sync routes
- Add conflict resolution logic
Deliverable: GraphQL API running against Postgres.
3. Data Migration from DynamoDB to Postgres
- Export DynamoDB tables
- Transform into relational shape
- Import into Postgres
- Verify referential integrity
Deliverable: Clean dataset in Postgres
4. Implement RxDB in Capacitor App
- Create RxDB schemas
- Create sync handler
- Create outbox mechanism
- Implement background sync
- Implement conflict feedback messages
Deliverable: Client app with full offline DB + sync.
5. Dual Run (Staged Rollout)
- Run old system and new system in parallel
- New system reads from Postgres only
- Gradually port features
Deliverable: Beta release for testing.
6. Cutover & Decommission
- Migrate all users to Capacitor app
- Turn off DataStore
- Remove DynamoDB relational tables
Deliverable: Final migrated system.