Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
feature: Added ability to validate database schema #6303
DO NOT DELETE THIS TEXT
If you would like to test this pull request then please run:
This is not ready for merging yet as it needs the deploy script finishing and adding to travis.
For users, validate will compare the database schema against a known working one and then provide queries to bring the schema into line. Some things...
When a PR is merged in, travis will rebuild the schema file and if it's changed then it will commit that to the master branch automatically. The only issue with this is if someone pulls in an update in the time it takes for a merge to happen and travis to rebuild the file - that's acceptable to me.
I like where this headed.
I don't mean to deflate your steam, but this would be a lot better with a DBAL/schema manager like Doctrine.
Maybe this is a needed stepping stone to that. We know that a lot of our user's databases are inconsistent. Mostly because we don't use transactions for our schema updates. (Which in turn requires error-free schema changes)
I'm aware the more permanent fix is using a dbal for this but we don't have that currently.
We do have inconsistencies within users db schemas right now and this is done to purely fix this and bridge the gap until we get something better in place. At present we assume users db's are correct so when helping to debug things we can end up on a wild goose chase until we realise it's because a schema update has been missed. This should stop that from happening for now.
It's automatic in it's approach so we don't need to do anything to maintain this at present, I expect it will generate some noise whilst we validate the output it produces but once we're happy we can just enable auto fixing.
It was hardly anytime to put it together so I'm not particular about it being merged in but I do prefer to spend my time enhancing the software rather than bug hunting :)
Never mind about the schema version, we can just check the files, duh.
I compared the outputs:
So yaml looks the best here. :)
I've added checks for extra tables and columns, is that ok?
Also, I noticed there is no check for the indexes. I think we should check that too if we can.