wulf-pulse/migrations/021_create_company_classifications_table.sql

23 lines
1.1 KiB
MySQL
Raw Permalink Normal View History

-- Create company_classifications table to store Autotask classification icons
CREATE TABLE IF NOT EXISTS company_classifications (
id SERIAL PRIMARY KEY,
classification_id INTEGER UNIQUE NOT NULL,
name VARCHAR(255) NOT NULL,
description TEXT,
is_active BOOLEAN DEFAULT true,
is_system BOOLEAN DEFAULT false,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
synced_at TIMESTAMP
);
-- Create index for faster lookups
CREATE INDEX IF NOT EXISTS idx_company_classifications_name ON company_classifications(name);
CREATE INDEX IF NOT EXISTS idx_company_classifications_active ON company_classifications(is_active);
-- Add comment
COMMENT ON TABLE company_classifications IS 'Company classification icons synced from Autotask';
COMMENT ON COLUMN company_classifications.classification_id IS 'Autotask classification icon ID';
COMMENT ON COLUMN company_classifications.name IS 'Classification name (e.g., Tools Only, Co-Managed)';
COMMENT ON COLUMN company_classifications.is_system IS 'Whether this is a system classification';