Skip to content

Option to run migrations without a transaction #767

@LukeMathWalker

Description

@LukeMathWalker

As far as my understanding goes, all migration scripts are currently run within a SQL transaction.
This creates issue in Postgres when trying to change a type (e.g. add a variant to an enum):

error: while executing migrations: 
error returned from database: 
ALTER TYPE ... ADD cannot run inside a transaction block

I'd say there are two ways forward:

  • make it the user responsibility to wrap its migration query in a transaction, if it makes sense;
  • add a way to "disable" transaction wrapping to the CLI.

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easycliConcerns `sqlx-cli`migrationsProposals or bugs involving migrationsproposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions