Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test for schema changes to stored config #842

Closed
danepowell opened this issue Dec 21, 2016 · 2 comments
Closed

Test for schema changes to stored config #842

danepowell opened this issue Dec 21, 2016 · 2 comments
Labels
Enhancement A feature or feature request

Comments

@danepowell
Copy link
Contributor

There's currently a major gap in the CM process that I've brought up a few times, such as here (last paragraph) and here. Basically, whenever a contributed module has a schema update (made through update hooks), that update needs to be baked into any relevant config in the codebase (whether in Features or core config). Unfortunately it's all too easy to forget to check for this when updating modules, so an automated test for this would be ideal.

The challenge is that there's no way for a test to know whether a given feature is overridden intentionally (due to a code change) or unintentionally (due to a db change, i.e. schema update). One solution is to check for overrides after a db update, and fail tests if db updates are performed and a feature is overridden afterwards. This would have the side effect of basically forbidding db updates and features changes in the same PR.

@danepowell
Copy link
Contributor Author

danepowell commented Jan 5, 2017

I've toiled with this problem for several hours now, and I'm fairly convinced that it's impossible to prevent via automated tests. The problem is simply that we have two "canonical" sources of config. Database update hooks consider the database to hold the canonical configuration reference, while we would prefer to think of Features or core CM files on disk being the canonical reference. If both of those change at the same time, there's no way a machine can know which changes are correct. The best idea I could come up with would be to somehow force database updates to be applied to configuration files on disk as well. But it's hardly a foolproof solution, and feels pretty hacky.

Whatever solution exists to this problem, I think it's going to have to involve a massive rearchitecture of CM in Drupal.

In the short term, developers simply need to be aware that this problem exists and need to make sure that configuration changes get exported to disk whenever modules are updated. Using the no-overrides feature from #841 will aid with this (having clean features means that a developer can simply check if any features are overridden after running database updates).

@danepowell
Copy link
Contributor Author

I think the additional documentation in the features workflow doc (soon to be configuration workflow) is the best we can do for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement A feature or feature request
Projects
None yet
Development

No branches or pull requests

2 participants