SELECT column_name, table_name
FROM information_schema.KEY_COLUMN_USAGE
WHERE REFERENCED_TABLE_NAME = 'obchodny_partner'
      AND REFERENCED_COLUMN_NAME = 'id'
      AND TABLE_SCHEMA = "gmspider";


SET @op = 119;
SELECT * FROM clanok_obchodny_partner WHERE obchodny_partner_id = @op;
SELECT * FROM kalendar_udalost WHERE obchodny_partner_id = @op;
SELECT * FROM obchodny_partner_kategoria_obchodneho_partnera WHERE obchodny_partner_id = @op;
SELECT * FROM obchodny_partner_sluzba WHERE obchodny_partner_id = @op;
SELECT * FROM osoba WHERE obchodny_partner_id = @op;
SELECT * FROM pracovnik WHERE obchodny_partner_id = @op;
SELECT * FROM smernica WHERE obchodny_partner_id = @op;
SELECT * FROM zmluva WHERE obchodny_partner_id = @op;

#obnovenie kia
UPDATE obchodny_partner SET visibility_type = 1 WHERE id IN (119);
UPDATE smernica SET visibility_type = 1 WHERE id IN (351);
UPDATE dokument SET visibility_type = 1 WHERE smernica_id = 351;
UPDATE kalendar_udalost SET visibility_type = 1 WHERE obchodny_partner_id = 119;
UPDATE osoba SET visibility_type = 1 WHERE obchodny_partner_id = 119;