Skip to content
PromptLab by FEHMER TECH
ENDE
Coding

Migration Script Creation

Create safe database or code migration scripts with rollback functionality.

Prompt template

Create a safe migration script for the following migration:

**Migration Type:** [Database schema/Data migration/API version/Framework upgrade]
**From:** [CURRENT VERSION/STATE]
**To:** [TARGET VERSION/STATE]
**Database/System:** [SYSTEM]
**Estimated Data Volume:** [VOLUME]

**The script should include:**
1. **Pre-Migration Checks:** Prerequisite validation
   - Version check
   - Available disk space
   - Backup validation
   - Schema compatibility

2. **Migration Logic:**
   - Step-by-step migration with progress indication
   - Batch processing for large datasets
   - Idempotent operations (safe on retry)

3. **Rollback Plan:**
   - Complete rollback script
   - Point-by-point reversal

4. **Post-Migration Validation:**
   - Data integrity checks
   - Performance comparison before/after

5. **Logging:** Detailed log of all changes

Create both the up and down scripts.

Replace placeholders in [square brackets]: [Database schema/Data migration/API version/Framework upgrade][CURRENT VERSION/STATE][TARGET VERSION/STATE][SYSTEM][VOLUME]

How to use this template

Copy the prompt, replace the placeholders in square brackets with your details and paste it into the AI assistant of your choice. The more precise your details, the better the result.

Tips for better results

  • Describe the current and desired target structure
  • Specify the data volume for appropriate batch sizes
  • Ask for a test plan for the migration
  • Request a zero-downtime migration strategy

Suitable open models

The selection names current open models as a starting point for your own tests. It is not a measurement for this template.

Keywords: #migration #database #rollback #data-integrity

Last updated: