Add script to import data

This commit is contained in:
2025-01-09 01:17:26 -05:00
parent 05a066e47a
commit 5636a78589
6 changed files with 434 additions and 42 deletions

View File

@@ -1,36 +0,0 @@
CREATE DATABASE IF NOT EXISTS inventory_db;
USE inventory_db;
CREATE TABLE IF NOT EXISTS products (
id VARCHAR(36) PRIMARY KEY,
sku VARCHAR(50) UNIQUE NOT NULL,
name VARCHAR(255) NOT NULL,
description TEXT,
category VARCHAR(100),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS inventory_levels (
id VARCHAR(36) PRIMARY KEY,
product_id VARCHAR(36) NOT NULL,
quantity INT NOT NULL DEFAULT 0,
reorder_point INT,
reorder_quantity INT,
last_reorder_date TIMESTAMP,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
FOREIGN KEY (product_id) REFERENCES products(id)
);
CREATE TABLE IF NOT EXISTS inventory_transactions (
id VARCHAR(36) PRIMARY KEY,
product_id VARCHAR(36) NOT NULL,
transaction_type ENUM('purchase', 'sale', 'adjustment') NOT NULL,
quantity INT NOT NULL,
transaction_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
reference_number VARCHAR(100),
notes TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (product_id) REFERENCES products(id)
);