Multiple `migrate Up` blocks in a single file?
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 3.4k
- Forks
- 292
- PR merge metrics
- No merged PRs in 30d
Description
Can you have multiple -- +migrate Up blocks within a single file?
I'm specifically wondering about mixing transactional and non-transactional migrations.
ie,
-- +migrate Up
. . .
-- +migrate Up notransaction
. . .
-- +migrate Up
. . .
-- +migrate Down
. . .
As an example use case, I'd like to:
- create some tables within a transaction
- concurrently create some indexes (which postgres requires happens outside of a transaction)
- use the new indexes to create some constraints (this can again happen within a transaction)
I'm currently looking at creating multiple migration files, but if it's possible to simply put them all in a single file then that seems like a much better solution.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files, tests, or entry points. Start by tracing how -- +migrate Up and notransaction blocks are parsed and executed, then test the three-block example against PostgreSQL. Done means the supported behavior is established and covered by documentation or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, postgresql, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100