Logical mistake in "Transactional Migrations" chapter in Guide?

In the “Transactional Migrations” chapter there seems to be a logical mistake (or I am missing something obvious).

The note below first example says:

some DB queries cannot be put into a transaction. For some examples, please refer to implicit commit. If this is the case, you should still implement up() and down() , instead

When you click the given link you can read (in MySQL guide) you can read that CREATE TABLE is among those SQL commands that implicitly end any transaction active.

This means that the example given above this not is pointless. There’s not point in wrapping up $this->createTable() and $this->insert() into transaction (in safeUp()), because $this->createTable() commits that transaction and won’t be rolled back, if subsequent $this->insert() fails for any reason.

Am I correct?

While the implicit commit is the case for MySQL it might not be the case for all other DB engines. The example does not state it is for MySQL only.

1 Like