Spin up docker containers for local database in worktree mode

Feature request for product/service

Cursor IDE

Describe the request

In the worktree mode, code changes proposed by models may involve adjustments to the database (adjusting schemas, adding new tables, etc.). It’s dangerous to allow models to implement changes to a single database in this situation without generating database replicas in the first place.
Currently, there is no feature that enables automatic spin-up of database replicas in Cursor, and preparing replicas is tedious and pretty complicated.
I hope Cursor could provide the option to spin up docker containers which import schemas and data from local database and have them working in different worktree directories. Once a worktree is selected, containers would be dropped and removed while Cursor can apply changes to the actual database or at least provide a script for implementing the changes.

Operating System (if it applies)

MacOS

Hey, thanks for the feature request!

Currently, you can customize worktree initialization through .cursor/worktrees.json - this lets you run custom scripts when a worktree is created, including Docker commands. See the worktrees documentation for setup examples.

For database replicas specifically, you could potentially add Docker Compose commands to spin up isolated containers in your setup script. However, the automatic lifecycle management you’re describing (creating replicas on worktree creation, dropping them on apply/cleanup, then syncing changes back) would be a new feature.

I’ll make sure the team sees this request.

1 Like