18 lines
829 B
MySQL
18 lines
829 B
MySQL
|
|
-- 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);
|