apskel-pos-backend/migrations/000006_create_product_variants_table.up.sql
aditya.siregar 4f5950543e init
2025-07-18 20:10:29 +07:00

14 lines
573 B
SQL

-- Product variants table
CREATE TABLE product_variants (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
product_id UUID NOT NULL REFERENCES products(id) ON DELETE CASCADE,
name VARCHAR(255) NOT NULL,
price_modifier DECIMAL(10,2) DEFAULT 0.00,
metadata JSONB DEFAULT '{}',
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Indexes
CREATE INDEX idx_product_variants_product_id ON product_variants(product_id);
CREATE INDEX idx_product_variants_created_at ON product_variants(created_at);