wulf-pulse/migrations/064_create_company_picklists.sql

32 lines
1.5 KiB
MySQL
Raw Permalink Normal View History

-- Company Categories picklist table (synced from Autotask Companies.companyCategoryID field)
CREATE TABLE IF NOT EXISTS company_categories (
value INTEGER PRIMARY KEY,
label VARCHAR(200) NOT NULL,
is_active BOOLEAN DEFAULT true,
sort_order INTEGER DEFAULT 0,
synced_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Company Types picklist table (synced from Autotask Companies.companyType field)
CREATE TABLE IF NOT EXISTS company_types (
value INTEGER PRIMARY KEY,
label VARCHAR(200) NOT NULL,
is_active BOOLEAN DEFAULT true,
sort_order INTEGER DEFAULT 0,
synced_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX IF NOT EXISTS idx_company_categories_active ON company_categories(is_active);
CREATE INDEX IF NOT EXISTS idx_company_types_active ON company_types(is_active);
-- Seed new display settings keys into kiosk_settings
INSERT INTO kiosk_settings (setting_key, setting_value, description) VALUES
('kiosk_company_category_ids', '1', 'Comma-separated company category IDs to include in kiosk (default: 1=Recurring Revenue Customer)'),
('mobile_company_category_ids', '1', 'Comma-separated company category IDs to include in mobile (default: 1=Recurring Revenue Customer)'),
('mobile_excluded_company_ids', '', 'Comma-separated company IDs to exclude from mobile dashboard')
ON CONFLICT (setting_key) DO NOTHING;