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

18 lines
829 B
SQL

-- Payment methods table
CREATE TABLE payment_methods (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
organization_id UUID NOT NULL REFERENCES organizations(id) ON DELETE CASCADE,
name VARCHAR(100) NOT NULL,
type VARCHAR(50) NOT NULL CHECK (type IN ('cash', 'card', 'digital_wallet')),
processor VARCHAR(100),
configuration JSONB DEFAULT '{}',
is_active BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Indexes
CREATE INDEX idx_payment_methods_organization_id ON payment_methods(organization_id);
CREATE INDEX idx_payment_methods_type ON payment_methods(type);
CREATE INDEX idx_payment_methods_is_active ON payment_methods(is_active);
CREATE INDEX idx_payment_methods_created_at ON payment_methods(created_at);