-- adiciona coluna de application_laboratory_id
alter table crops add column application_laboratory_id integer references laboratories(id);
alter table customers add column application_laboratory_id integer references laboratories(id);

-- Define laboratório padrão para todos os canais e safras
update customers set application_laboratory_id = (select id from laboratories where is_application = true order by id limit 1);
update crops set application_laboratory_id = (select id from laboratories where is_application = true order by id limit 1);