• DATA INTEGRITY
  • MASS UPDATES
  • HUMAN REVIEW
  • STATE SYNC

How to run database migrations with your AI

Connect Convex to your AI client to handle heavy data lifting. Once connected, your agent can trigger precise, transactional updates across your entire database.

Ask AI about this page

Short answer

Can my AI run database migrations?

Yes. Your AI uses the run_mutation tool to execute ACID-compliant transactions. This allows you to perform mass record updates or complex data shifts safely. You'll see exactly how the agent handles these changes below.

The results of a migration.

Where your data lands.

When you ask your agent to modify data, these are the outcomes.

DATA INTEGRITY

Safe, atomic updates

The agent uses ACID-compliant transactions to ensure every change either succeeds completely or fails without leaving partial data. You won't end up with corrupted records.

MASS UPDATES

Bulk record changes

Instead of manual scripts, your agent handles large-scale modifications. It applies the logic you describe to many records at once.

HUMAN REVIEW

Manual verification

The AI identifies the specific records it needs to change. You stay in control by reviewing the proposed logic before the agent commits the mutation.

STATE SYNC

Consistent database state

The agent ensures your schema and data stay in sync after a migration. You get a predictable database that matches your new requirements.

The workflow

What your AI does when the migration request arrives.

The agent moves from understanding your intent to executing the actual database write.

  1. Analyze the schema

    Your agent looks at your current Convex data structure to understand the existing records and types.

    run_mutation
  2. Draft the mutation

    The agent writes the specific logic required to transform your data according to your instructions.

    run_mutation
  3. Execute the update

    The agent triggers the actual data change using the provided tool to ensure the transaction is atomic.

    run_mutation
  4. Confirm success

    The agent verifies that the mutation completed and reports the outcome of the changes.

    run_mutation

Try it

Copy these to start.

Use these prompts to kick off your first migration.

Starting points

These are templates. Swap out the bracketed text with your specific table names or field requirements.

Convex Connector

You're all set. Choose your MCP client and follow the setup instructions.

Connector linkhttps://edge.vinkius.com/vk_preview_MADGSG1GwcjX2nZFJX7QdDYmcBCtd1WoRLCUHsG9/mcp

Claude Desktop

Follow the steps below to connect in seconds.

  1. 1In Claude Desktop, open Settings → Connectors.
  2. 2Click “Add custom connector” and paste the connector link above as the remote MCP server URL.
  3. 3Click Add and start a new chat — Convex capabilities are ready to use.
Configuration · claude_desktop_config.jsonCopy
{
  "mcpServers": {
    "convex-mcp": {
      "url": "https://edge.vinkius.com/vk_preview_MADGSG1GwcjX2nZFJX7QdDYmcBCtd1WoRLCUHsG9/mcp"
    }
  }
}
Copy into chat04
  • Run a mutation to add a 'status' field to all users in the users table.

  • Update all records in the orders table where the total is over 100 to set the category to 'premium'.

  • Migrate the data in the profiles table by moving the 'bio' field into a new nested object.

  • Change the data type of the 'timestamp' field in the logs table for all entries from last week.

  • Claude
  • ChatGPT
  • Cursor
  • VS Code
  • Windsurf
  • Claude Code
  • JetBrains
  • Cline

Start here

Connect Convex once, then ask.

Just click the link to connect your Convex account. Your credentials stay encrypted and secure, and you can immediately start talking to your data through your favorite AI client.

Connect Convex to your AI

FAQ

How this task behaves.

  • 01

    Can the AI delete my entire database?

    No. The agent only performs the specific mutations you request through the run_mutation tool.

  • 02

    Does the AI handle the transaction logic?

    Yes. The agent uses ACID-compliant transactions, meaning the update is all-or-nothing to prevent partial data writes.

  • 03

    Will the AI automatically run a script without my permission?

    No. The agent proposes the logic first, and you decide when to trigger the execution.

  • 04

    Can the AI create new tables?

    No. The agent is limited to performing mutations on existing data structures.

  • 05

    What happens if a migration fails halfway through?

    Because the agent uses ACID transactions, a failure will roll back all changes in that specific mutation, leaving your data exactly as it was before the attempt.

  • More questions about Convex? See everything the Convex Connector can do

Connect Convex to Claude, Cursor, ChatGPT & more