Skip to main content
AIPromptIndex
Cursor Coding advanced

Cursor Migration Helper

Added Apr 2, 2026

You are a database and system migration expert. Help me plan and execute a migration from [SOURCE_SYSTEM] to [TARGET_SYSTEM] for a [PROJECT_TYPE] project. The current system handles [CURRENT_FUNCTIONALITY] with approximately [DATA_VOLUME] of data. Generate a complete migration plan that includes: a pre-migration checklist (data audit, dependency mapping, backup strategy), schema mapping between source and target with transformation rules for each field, migration scripts in [LANGUAGE] with transaction safety and rollback capabilities, data validation queries that compare source and target after migration, a feature flag strategy for gradual rollout, a rollback plan with specific triggers for when to abort, estimated downtime calculation and strategies to minimize it, and post-migration verification steps. For the migration scripts, handle these specific challenges: [MIGRATION_CHALLENGES]. Include error handling for partial failures and a progress tracking mechanism. Write the scripts to be idempotent so they can be safely re-run.
0
Share
Try in Cursor

About This Prompt

This prompt generates comprehensive database and system migration plans with executable scripts that handle the full lifecycle from planning through verification. Migrations are among the riskiest operations in software development, and this prompt addresses that risk with transaction-safe scripts, rollback plans, validation queries, and gradual rollout strategies. The output includes idempotent migration scripts that can be safely re-run if interrupted, along with data validation to ensure nothing is lost or corrupted. This is essential for engineering teams migrating databases, upgrading frameworks, switching providers, or refactoring data models in production systems.

Variables to Customize

[SOURCE_SYSTEM]

The current system being migrated from

Example: MongoDB with Mongoose ODM

[TARGET_SYSTEM]

The system being migrated to

Example: PostgreSQL with Prisma ORM

[PROJECT_TYPE]

Type of application

Example: SaaS multi-tenant application

[CURRENT_FUNCTIONALITY]

What the current system manages

Example: user accounts, subscriptions, invoices, and activity logs

[DATA_VOLUME]

Approximate amount of data

Example: 2 million records across 15 collections

[LANGUAGE]

Programming language for migration scripts

Example: TypeScript with Node.js

[MIGRATION_CHALLENGES]

Specific challenges to address

Example: nested MongoDB documents need to be flattened into relational tables, ObjectId references need to map to integer foreign keys, and some fields have inconsistent data types

Tips for Best Results

  • Always test the migration on a staging copy of production data before running it live
  • Use the generated validation queries after every migration run to catch data integrity issues
  • Plan for twice the estimated downtime as a safety margin

Example Output

# Migration Plan: MongoDB to PostgreSQL

## Pre-Migration Checklist
- [ ] Full MongoDB backup completed and verified
- [ ] Schema audit: 15 collections mapped to relational tables
- [ ] Dependency map: 23 services read from MongoDB, 8 write

## Schema Mapping
| MongoDB Collection | PostgreSQL Table | Key Transformations |
|---|---|---|
| users | users | ObjectId -> UUID, nested address -> addresses table |
| subscriptions | subscriptions | embedded plan -> FK to plans table |

## Migration Script (Phase 1: Users)
```typescript
async function migrateUsers(batchSize = 1000) {
  const client = await pool.connect();
  try {
    await client.query('BEGIN');
    ...
database-migration devops data-engineering backend system-architecture

Get the Best AI Prompts Weekly

Curated prompts, tips, and guides delivered to your inbox every week. Free.