Skip to content

Multiple migrate Up blocks in a single file? #244

@tjlevel12

Description

@tjlevel12

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions