Skip to content

Fix/ddl implicit commit in transactions#58

Merged
benkhalife merged 4 commits into
mainfrom
fix/ddl-implicit-commit-in-transactions
Jun 28, 2026
Merged

Fix/ddl implicit commit in transactions#58
benkhalife merged 4 commits into
mainfrom
fix/ddl-implicit-commit-in-transactions

Conversation

@benkhalife

Copy link
Copy Markdown
Member

No description provided.

inTransaction() previously relied only on the internal transactionDepth
counter, which doesn't know that MySQL implicitly commits the active
transaction on any DDL statement (CREATE TABLE, ALTER TABLE, DROP
TABLE, ...). commit() now treats an already-closed transaction as a
no-op instead of calling PDO::commit() again, which throws on PHP 8+
when there is no active transaction. rollBack() now throws a clear,
descriptive exception instead of a generic PDO error when nothing is
left to roll back.

Fixes migrations failing with "Database transaction [commit] failed"
on MySQL even though the DDL statement itself succeeded.
New DatabaseException factory describing the case where a rollback
can no longer be honored because a prior DDL statement already
committed the transaction implicitly. Used by Connection::rollBack().
Each test in TransactionDdlTest now uses its own uniquely-named table
and drops it in a finally block, instead of sharing one table name
across the whole class. IntegrationTestCase only tears down schema at
the class level, so a table created by one test (and never cleaned up
mid-class) collided with the next test trying to create the same
table — surfacing as "Table already exists" on MySQL, where the
implicit commit makes the table persist for real instead of staying
inside a rolled-back transaction as it would on SQLite.
Adds full documentation for the new make:migration and migrate
commands (stub selection logic, actions, options, examples).
Removes the botfire:init section and table entry, which referenced
Telegram bot scaffolding that was already removed from the library.
@benkhalife benkhalife merged commit 9a43207 into main Jun 28, 2026
11 checks passed
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.

1 participant