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

Suggestion: Validation between class fields and table columns #187

Closed
petercranston opened this issue Jan 29, 2019 · 6 comments
Closed

Suggestion: Validation between class fields and table columns #187

petercranston opened this issue Jan 29, 2019 · 6 comments
Labels
enhancement New feature or request new module

Comments

@petercranston
Copy link
Contributor

Motivation

I recently came across a site where previous developers had added new columns directly to the database, without going through the recommended process of adding them as a field on a kentico class. I wanted an easy way to validate all kentico classes against the database to see how widespread the problem was.

Proposed solution

A new module to lookup the fields for each class (parsing the ClassXmlSchema) and comparing that with the columns in the database. I've developed a proof of concept module to do this which I can create a pull request for.

@ChristopherJennings
Copy link
Contributor

Hi Peter,

This sounds like a really excellent module. What is the state of your proof of concept? If it's not ready for a full PR yet, would you mind linking to it here so we can take a look and provide some feedback? Did you have any questions we can help with to get this ready for a PR?

@petercranston
Copy link
Contributor Author

Hi Christopher,
I've tested it on the Kentico 10 site that I mention above and it works well for that. I haven't checked it against other versions of kentico, and I haven't yet implemented any error handling. The link to my forked repo is here.

@ChristopherJennings
Copy link
Contributor

Hi @petercranston, thanks for your patience on this.

Could you submit a draft PR for this per this new GH feature?

@ChristopherJennings
Copy link
Contributor

Also, I've just taken a quick look at this and at first blush it looks good. I did notice that in my clean 11 instance table name case is giving some false negatives. So, one thing that could be improved is to make table names case-insensitive like you did for column names. My other testing showed exactly what I expected though (column in class, but not DB; column in DB, but not class; and field type "not represented in database" not being returned in report)

I think you're probably safe to go straight to a normal PR if you add the table name case insensitivity.

Thanks for the excellent work!

@petercranston
Copy link
Contributor Author

@ChristopherJennings I've made the updates as suggested. Thanks!

@ChristopherJennings
Copy link
Contributor

Thanks for the PR! I've pulled the changes into master and it'll be included in the next release. I'm currently waiting on one more PR that's nearly done before I issue a new release, but it should be soon.

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

No branches or pull requests

2 participants