Prestashop: Tool for check integrity of prestashop DB

Created on 8 Mar 2020  路  8Comments  路  Source: PrestaShop/PrestaShop

Is seems that prestashop autoupgrade module some time make mistake, i will aprociate a tool that checks if prestashop tables are set correctly, in case that in some upgrade some table was not setted propretly

Autoupgrade Developer Feature Improvement To Do

Most helpful comment

It's a nice idea.
Adding a tool that is able to compare the database structure and tell if:

  • fields are here with the right type & length
  • fields shouldn't be there
  • all tables are present

All 8 comments

Is seems that prestashop autoupgrade module some time make mistake, i will aprociate a tool that checks if prestashop tables are set correctly, in case that in some upgrade some table was not setted propretly

Unfortunately this would be very hard to do because modules are able to modify the SQL schema so the tool would inform user about false issues. 馃槶

OK but with a check tool you can have ad idea if something was not set correctly and then check is if caused by a module

OK but with a check tool you can have ad idea if something was not set correctly and then check is if caused by a module

Yes and no ... 馃槬because PrestaShop is both a software ready-to-be-used and a development platform used by developers to build something on top of it. We have seen people rework the SQL schema for their specific needs. And if someone wants to modify how PrestaShop behaves, it's his full right as it's an open source software.

The only thing we could do in a reliable way would be to create a tool that would say "Your SQL schema is (or is not) compliant with PrestaShop standard structure for version X"

Hello,

I try to explain better: let's admit that I don't use external prestashop modules and I want to know if the prestashop database structure is correct, a tool that does the checking would be useful.

If then I installed an external module and possibly the tool checks me and sees the modified tables I can go to see if they are related to that module.

But at least if I have not applied changes in prestashop I am sure that the database is intact, as I have seen several times the update procedures do not work very well and it may be that they do not update the tables. In this case a check of the tables would avoid hours of searching for errors..

Ping @PrestaShop/prestashop-core-developers what do you think?

Thanks!

It's a nice idea.
Adding a tool that is able to compare the database structure and tell if:

  • fields are here with the right type & length
  • fields shouldn't be there
  • all tables are present

If there is any vague issue create here on PrestaShop, you can say run psdatacheck module and send the report here.

There have been issues, like:

  • Modules adding columns to tables PrestaShop's native tables, which despite all the advice, still happens
  • Payment modules that fail and create an corrupt `ps_ordere_history, see #16657 and #19098
  • autoupgrade
  • Overrides that manipulate the data incorrectly

There are more ways to corrupt data... of course.

The tool could check if

  • relations exist in the database, like: ps_category.id_parent, ps_order_detail.id_order, ps_order_state.id_order_state
  • Columns match with the ObjectModel classes. Are any extra columns added? Does the character length match?

It might help a lot of the issues on GitHub that are not reproducible. The data structure might give a clue.

Was this page helpful?
0 / 5 - 0 ratings