fix: agrega migración v4.6 con tablas categories y tier_discounts para tenant
This commit is contained in:
@@ -52,6 +52,7 @@ MIGRATIONS = {
|
|||||||
"v4.3": "v4.3_facturapi.sql",
|
"v4.3": "v4.3_facturapi.sql",
|
||||||
"v4.4": "v4.4_workshop.sql",
|
"v4.4": "v4.4_workshop.sql",
|
||||||
"v4.5": "v4.5_customer_max_discount.sql",
|
"v4.5": "v4.5_customer_max_discount.sql",
|
||||||
|
"v4.6": "v4.6_inventory_support.sql",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
20
pos/migrations/v4.6_inventory_support.sql
Normal file
20
pos/migrations/v4.6_inventory_support.sql
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
-- 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
|
||||||
|
);
|
||||||
Reference in New Issue
Block a user