OpenParable
Skip to content
← Back to skills

Create Backend Migration

Development
create-backend-migration

Create Backend Migration is an Agent Skill for development published in the erxes/erxes repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Create safe erxes backend MongoDB migrations or command scripts. Use when existing persisted data needs idempotent migration, backfill, repair, or cleanup.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/erxes/erxes/blob/HEAD/.agents/skills/create-backend-migration/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/create-backend-migration, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Skill: Create Backend Migration

Workflow

  1. Confirm a migration or command is actually needed for existing data.
  2. Search for service-local migration or command patterns before adding files.
  3. Put the script in the owning service or plugin's existing location, such as src/migrations or src/commands.
  4. Make the script idempotent so running it twice does not corrupt data.
  5. Read MONGO_URL or service env values consistently with nearby scripts.
  6. Process large collections in batches when practical.
  7. Log useful progress without logging secrets, tokens, or sensitive payloads.
  8. Close database connections or exit cleanly.
  9. Run focused validation, usually pnpm nx build <api-project>.

Important

  • Do not add migrations for purely frontend changes.
  • Prefer guarded $set, $unset, $addToSet, and filtered updates over full document replacement.
  • Avoid hardcoded tenant, brand, user, or subdomain data.
  • Preserve existing ID conventions.
  • Do not add temporary public GraphQL mutations or routes for migrations unless explicitly requested.