16 lines
656 B
SQL
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); |