Proposed table structure:
Code:
# use this table name since we want to use the code from store credit module
CREATE TABLE sc_customer (
`customer_id` int(11) NOT NULL,
`amount` float NOT NULL default '0',
`created_on` int(11) NOT NULL DEFAULT '0',
`modified_on` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY ( `customers_id` )
);
# holding category specific ratio
CREATE TABLE sc_categories_ratio (
`categories_id` int(11) NOT NULL,
`ratio` float NOT NULL DEFAULT '1',
PRIMARY KEY ( `categories_id` )
);
# holding products specific ratio
CREATE TABLE sc_categories_ratio (
`products_id` int(11) NOT NULL,
`ratio` float NOT NULL DEFAULT '1',
PRIMARY KEY ( `products_id` )
);
# log table
CREATE TABLE sc_logs (
`products_id` int(11) NOT NULL,
`orders_id` int(11) NOT NULL,
`ratio` float NOT NULL,
`amount` float NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT '0' ,
`created_on` int(11) NOT NULL DEFAULT '0',
`modified_on` int(11) NOT NULL DEFAULT '0',
)
Bookmarks