-- Customer blacklist columns (run once)
ALTER TABLE customers
    ADD COLUMN IF NOT EXISTS blacklisted      TINYINT(1)   NOT NULL DEFAULT 0,
    ADD COLUMN IF NOT EXISTS blacklist_reason VARCHAR(500)          DEFAULT NULL,
    ADD COLUMN IF NOT EXISTS blacklisted_at   DATETIME              DEFAULT NULL,
    ADD COLUMN IF NOT EXISTS blacklisted_by   INT UNSIGNED          DEFAULT NULL;

-- Optional FK (only if users table exists)
-- ALTER TABLE customers ADD FOREIGN KEY (blacklisted_by) REFERENCES users(id) ON DELETE SET NULL;

-- admin_note column used by CustomerModel::update()
ALTER TABLE customers
    ADD COLUMN IF NOT EXISTS admin_note TEXT DEFAULT NULL;

-- Index speeds up blacklist filter in CustomerModel::list()
ALTER TABLE customers
    ADD INDEX IF NOT EXISTS idx_customers_blacklisted (blacklisted);
