ALTER TABLE technicians
    ADD COLUMN company_id BIGINT UNSIGNED NULL AFTER user_id;

UPDATE technicians t
JOIN users u ON u.id = t.user_id
SET t.company_id = u.company_id
WHERE t.company_id IS NULL;

ALTER TABLE technicians
    MODIFY COLUMN company_id BIGINT UNSIGNED NOT NULL,
    ADD KEY idx_technicians_company (company_id),
    ADD CONSTRAINT fk_technicians_company
        FOREIGN KEY (company_id) REFERENCES companies (id)
        ON DELETE RESTRICT ON UPDATE CASCADE;
