News:

Support the VirtueMart project and become a member

Main Menu

VM 2.0.2 bug or feature

Started by franzpeter, March 01, 2012, 18:46:06 PM

Previous topic - Next topic

franzpeter

While analyzing the tables in the database I did see the following things:
jos_virtuemart_products: virtuemart_product_id is AUTO_INCREMENT

in jos_virtuemart_products_en_en or jos_virtuemart_products_de_de the virtuemart_product_id is AUTO_INCREMENT too. Same thing with the jos_virtuemart_categories and the language table jos_virtuemart_categories_en_en. Why do we use AUTO_INCREMENT product_id or AUTO_INCREMENT in the category tables in a double way.

Example: There is a product in the product table say hammer. It has the product_id 1 and it has the product_id 1 in the language table, what deeper sense does it make to use there an auto increment instead just simply add the product_id from the product table into the language table? If a product failed to upgrade by server issue or something else, it could be that the product_id could be different to the product_id in the language table. Would it not be better for consistency to just use the one time created auto_increment product_id from the jos_virtuemart_products table to insert into the other tables like the language table, the price table a.s.o.?

Could someone from the developers please explain, why we use 2 different auto_increment id for the same thing?

Milbo

We use 2 different auto_increment for the same thing?

You are right that we could remove the auto_increment from the lang tables. on the other hand, it just perfect works, we never had trouble with it.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

franzpeter

@Milbo

the trouble may come if a product import goes wrong and two different auto increment product_id are created for the same product, one time in the product table and one different in the language table, because both have no relation to each other. Autoincrement, as the name says creates id itself. The language table like the price table a.s.o. normally refer to the product table. Every product has a unique id to identify it in different tables. Using auto increment for the same thing more than one time does not make sense. If an import component produces errors, you may have difficulties to restore a database, especially if you use different language tables.

So if you say that you could remove it it says too that it is unnecessary. So for my shop I'll remove it.

Milbo

Yes, that is correct. One of them should be Only primary unique.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/