Skip to content

Conversation

@Billuc
Copy link
Owner

@Billuc Billuc commented Jan 8, 2026

Closes #43
Adds the disable_transaction option. This option only works with single query migrations. When activated, the migration will be applied without using a transaction. This is useful for some concurrent operations like CREATE INDEX CONCURRENTLY.

Copy link

@brian-penguin brian-penguin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Thanks for taking the time to add this. I got to test it out and it works great. Codewise I'm still pretty new to Gleam but
I had a suggestion for the error message to make it more clear.

There's also a little quirk when you run the all migration command with multiple disabled transactions you can get multiple migrations applied messages in the output. In this case the last two indexing created_at and updated_at are both concurrent

➜ env DATABASE_URL=postgres://postgres:postgres@localhost:5432/ bin/db-migrate
   Compiled in 0.07s
    Running cigogne.main

Applying migration 20251007122321-create_timestamp_triggers
Applying migration 20251007124816-create_todo_items

Migrations applied:
	20251007122321-create_timestamp_triggers
	20251007124816-create_todo_items
	20251031154116-index_todo_created_at
	20260126142615-index_todo_updated_at
Applying migration 20251031154116-index_todo_created_at
Applying migration 20260126142615-index_todo_updated_at

Migrations applied:
	20251007122321-create_timestamp_triggers
	20251007124816-create_todo_items
	20251031154116-index_todo_created_at
	20260126142615-index_todo_updated_at

MultipleQueriesInNoTransactionMigration(filepath:) ->
"In file "
<> filepath
<> ": Multiple queries found in a migration with disabled transaction"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would you feel about having more to this error that tells the user what to do next. something like

Multiple queries found in a migration with disabled transaction: Only a single query statement is allowed within a `--- migration:up:disable_transaction`. Use multiple migrations to support multiple concurrent operations.

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

Successfully merging this pull request may close these issues.

Question: How to support concurrent operations?

2 participants