Files
Autoparts-DB/pos/migrations/v4.6_inventory_support.sql
consultoria-as 98e037c09a
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
fix: agrega migración v4.6 con tablas categories y tier_discounts para tenant
2026-06-25 23:14:31 +00:00

21 lines
738 B
SQL

-- Tenant DB schema v4.6 — support tables for inventory UI
-- Product categories (hierarchical, optional)
CREATE TABLE IF NOT EXISTS categories (
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
parent_id INTEGER REFERENCES categories(id) ON DELETE SET NULL,
is_active BOOLEAN DEFAULT true,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_categories_parent ON categories(parent_id);
CREATE INDEX IF NOT EXISTS idx_categories_active ON categories(is_active);
-- Tier-based discount configuration for price tiers 2 and 3
CREATE TABLE IF NOT EXISTS tier_discounts (
tier_id INTEGER PRIMARY KEY,
tier_name VARCHAR(50) NOT NULL,
discount_pct NUMERIC(5,2) DEFAULT 0
);