Fix/ddl implicit commit in transactions#58
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.