Remove duplicate table creates
This commit is contained in:
@@ -102,19 +102,17 @@ CREATE TABLE IF NOT EXISTS product_time_aggregates (
|
|||||||
INDEX idx_date (year, month)
|
INDEX idx_date (year, month)
|
||||||
);
|
);
|
||||||
|
|
||||||
-- Create vendor details table
|
-- Create vendor_details table
|
||||||
CREATE TABLE IF NOT EXISTS vendor_details (
|
CREATE TABLE vendor_details (
|
||||||
vendor VARCHAR(100) NOT NULL,
|
vendor VARCHAR(100) PRIMARY KEY,
|
||||||
contact_name VARCHAR(100),
|
contact_name VARCHAR(100),
|
||||||
email VARCHAR(100),
|
email VARCHAR(255),
|
||||||
phone VARCHAR(20),
|
phone VARCHAR(50),
|
||||||
status VARCHAR(20) DEFAULT 'active',
|
status VARCHAR(20) DEFAULT 'active',
|
||||||
notes TEXT,
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
INDEX idx_status (status)
|
||||||
PRIMARY KEY (vendor),
|
) ENGINE=InnoDB;
|
||||||
INDEX idx_vendor_status (status)
|
|
||||||
);
|
|
||||||
|
|
||||||
-- New table for vendor metrics
|
-- New table for vendor metrics
|
||||||
CREATE TABLE IF NOT EXISTS vendor_metrics (
|
CREATE TABLE IF NOT EXISTS vendor_metrics (
|
||||||
@@ -411,20 +409,3 @@ LEFT JOIN
|
|||||||
|
|
||||||
-- Re-enable foreign key checks
|
-- Re-enable foreign key checks
|
||||||
SET FOREIGN_KEY_CHECKS = 1;
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
|
|
||||||
-- Create table for sales seasonality factors
|
|
||||||
CREATE TABLE IF NOT EXISTS sales_seasonality (
|
|
||||||
month INT NOT NULL,
|
|
||||||
seasonality_factor DECIMAL(5,3) DEFAULT 0,
|
|
||||||
last_updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
PRIMARY KEY (month),
|
|
||||||
CHECK (month BETWEEN 1 AND 12),
|
|
||||||
CHECK (seasonality_factor BETWEEN -1.0 AND 1.0)
|
|
||||||
);
|
|
||||||
|
|
||||||
-- Insert default seasonality factors (neutral)
|
|
||||||
INSERT INTO sales_seasonality (month, seasonality_factor)
|
|
||||||
VALUES
|
|
||||||
(1, 0), (2, 0), (3, 0), (4, 0), (5, 0), (6, 0),
|
|
||||||
(7, 0), (8, 0), (9, 0), (10, 0), (11, 0), (12, 0)
|
|
||||||
ON DUPLICATE KEY UPDATE last_updated = CURRENT_TIMESTAMP;
|
|
||||||
@@ -79,18 +79,6 @@ CREATE TABLE categories (
|
|||||||
INDEX idx_name_type (name, type)
|
INDEX idx_name_type (name, type)
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- Create vendor_details table
|
|
||||||
CREATE TABLE vendor_details (
|
|
||||||
vendor VARCHAR(100) PRIMARY KEY,
|
|
||||||
contact_name VARCHAR(100),
|
|
||||||
email VARCHAR(255),
|
|
||||||
phone VARCHAR(50),
|
|
||||||
status VARCHAR(20) DEFAULT 'active',
|
|
||||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
||||||
INDEX idx_status (status)
|
|
||||||
) ENGINE=InnoDB;
|
|
||||||
|
|
||||||
-- Create product_categories junction table
|
-- Create product_categories junction table
|
||||||
CREATE TABLE product_categories (
|
CREATE TABLE product_categories (
|
||||||
cat_id BIGINT NOT NULL,
|
cat_id BIGINT NOT NULL,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
#Clear previous mount in case it’s still there
|
#Clear previous mount in case it’s still there
|
||||||
umount ~/Dev/inventory/inventory-server
|
umount /Users/matt/Library/Mobile Documents/com~apple~CloudDocs/Dev/inventory/inventory-server
|
||||||
|
|
||||||
#Mount
|
#Mount
|
||||||
sshfs matt@dashboard.kent.pw:/var/www/html/inventory -p 22122 ~/Dev/inventory/inventory-server/
|
sshfs matt@dashboard.kent.pw:/var/www/html/inventory -p 22122 /Users/matt/Library/Mobile Documents/com~apple~CloudDocs/Dev/inventory/inventory-server/
|
||||||
Reference in New Issue
Block a user