Add calculate time tracking
This commit is contained in:
@@ -171,14 +171,6 @@ ORDER BY
|
||||
c.name,
|
||||
st.vendor;
|
||||
|
||||
-- Update calculate_history table to track all record types
|
||||
ALTER TABLE calculate_history
|
||||
ADD COLUMN total_orders INT DEFAULT 0 AFTER total_products,
|
||||
ADD COLUMN total_purchase_orders INT DEFAULT 0 AFTER total_orders,
|
||||
CHANGE COLUMN products_processed processed_products INT DEFAULT 0,
|
||||
ADD COLUMN processed_orders INT DEFAULT 0 AFTER processed_products,
|
||||
ADD COLUMN processed_purchase_orders INT DEFAULT 0 AFTER processed_orders;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS calculate_history (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
start_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
@@ -197,6 +189,21 @@ CREATE TABLE IF NOT EXISTS calculate_history (
|
||||
INDEX idx_status_time (status, start_time)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS calculate_status (
|
||||
module_name ENUM(
|
||||
'product_metrics',
|
||||
'time_aggregates',
|
||||
'financial_metrics',
|
||||
'vendor_metrics',
|
||||
'category_metrics',
|
||||
'brand_metrics',
|
||||
'sales_forecasts',
|
||||
'abc_classification'
|
||||
) PRIMARY KEY,
|
||||
last_calculation_timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
INDEX idx_last_calc (last_calculation_timestamp)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS sync_status (
|
||||
table_name VARCHAR(50) PRIMARY KEY,
|
||||
last_sync_timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
Reference in New Issue
Block a user