I dont know what type of Audit logging system do I need for my tables design.
Sometime staff change the name of the product, price, options or extras with it. But we don't keep the history what have been updated or deleted.. how to deal with this situation?
Use Audit (history table) or versioning type? Please provide example for my tables design.
A product contain one or more options. An Option can have extras or without extras.
Tables design example:
Product Table:
mysql> select * from products;
+-----------+------------+
| ProductID | Name |
+-----------+------------+
| 1 | Hard Drive |
+-----------+------------+
Options Table: (There are two options from ProductID 1)
mysql> select * from options;
+----------+-----------+---------+-------+
| OptionID | ProductID | Name | Price |
+----------+-----------+---------+-------+
| 1 | 1 | Samsung | 55.00 |
| 2 | 1 | Hitachi | 20.00 |
+----------+-----------+---------+-------+
Extras Table: (OptionID 2 have two Extras... OptionID 1 without Extra)
mysql> select * from extras;
+---------+----------+------------------+--------+
| ExtraID | OptionID | Name | Price |
+---------+----------+------------------+--------+
| 1 | 2 | 10 Year Warranty | 100.00 |
| 2 | 2 | 20 Year Warranty | 250.00 |
+---------+----------+------------------+--------+
If I change the name of the product (products.name
)... should options and extras data (whatever ProductID is linked to) automatically add into history table or use versioning method?
Some product have like 20 options, each option have like 10 extras.
I have over 300,000 rows in the options and extras tables.
I have Order and Order_Items tables.. In the Order_Items table it contain list of OptionID (FK) but I did include the Option Name... So if I change the Option Name (options.Name
) then the order will be effected.