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

16 lines
656 B
SQL

-- Categories table
CREATE TABLE categories (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
organization_id UUID NOT NULL REFERENCES organizations(id) ON DELETE CASCADE,
name VARCHAR(255) NOT NULL,
description TEXT,
business_type VARCHAR(50) DEFAULT 'restaurant',
metadata JSONB DEFAULT '{}',
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Indexes
CREATE INDEX idx_categories_organization_id ON categories(organization_id);
CREATE INDEX idx_categories_business_type ON categories(business_type);
CREATE INDEX idx_categories_created_at ON categories(created_at);