Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple migrate Up blocks in a single file? #244

Open
tjlevel12 opened this issue May 31, 2023 · 1 comment
Open

Multiple migrate Up blocks in a single file? #244

tjlevel12 opened this issue May 31, 2023 · 1 comment

Comments

@tjlevel12
Copy link

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.

@rubenv
Copy link
Owner

rubenv commented May 31, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants