doctrine / migrations

Doctrine Database Migrations Library
https://www.doctrine-project.org/projects/migrations.html
MIT License
4.68k stars 385 forks source link

Add warning about implicit commit to documentation #1382

Open shylux opened 10 months ago

shylux commented 10 months ago
Q A
Version 3.7.1

Documentation Request

Hi i just spent a lot of time debugging why the rollback on our migrations don't seem to work.
Well the code looks good, but if it encounters an error the rollback never works because the transaction is gone.
From what i found out i am 90% sure it is because we use statements that do an implicit commit: https://dev.mysql.com/doc/refman/8.0/en/implicit-commit.html The listed statements, especially ALTER TABLE are used in pretty much all migrations. And i am sure others will have the same issue.

I am not sure how many db softwares this affects. But it would be nice to have an info box here that warns about this behavior: https://www.doctrine-project.org/projects/doctrine-migrations/en/3.7/reference/configuration.html#all-or-nothing-transaction

greg0ire commented 10 months ago

Pretty sure I covered this here: https://www.doctrine-project.org/projects/doctrine-migrations/en/stable/explanation/implicit-commits

agustingomes commented 10 months ago

In all fairness, I think a reference to the explanation can be linked within the --all-or-nothing detail. because I believe not many people may be aware of the ramifications of the DB engines like MySQL not supporting transactional DDL.

I was also bitten by this lack of awareness when working on a migration last year, which then led to this PR and the subsequent ones I made.

Another thing I noticed, the Implicit commits sidebar only appears on the index page which may reduce the visibility as people may come from a google search, not landing on the index page.

greg0ire commented 10 months ago

Seems fair. Please send PRs to address these issues.

agustingomes commented 10 months ago

I will look into it these days.

agustingomes commented 10 months ago

@greg0ire how can I test the documentation changes locally? I cannot find any tooling locally.

greg0ire commented 10 months ago

Right now you can't, in the future you will be able to once we migrate to phpDocumentor/guides In the meantime, all you have is Github's preview, unless you're willing to install doctrine-website (which, while hard should be far easier than a few months ago)

agustingomes commented 10 months ago

unless you're willing to install doctrine-website

I'll give it a go, because I think to implement my suggestionI'll need to understand why the explanation on the sidebar disappears on other pages besides the index.rst.

agustingomes commented 1 month ago

@greg0ire apologies, I ended up forgetting about this issue. I'm not sure I would be able to come back to this experimentation I wanted to make. will need to allocate some time to look into this.