Sequel.migration do transaction up do run 'ALTER TABLE `nodes` ADD CONSTRAINT `node_datacenter_id` FOREIGN KEY (`datacenter_id`) REFERENCES `datacenters` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;' run 'ALTER TABLE `nodes` ADD CONSTRAINT `node_environment_id` FOREIGN KEY (`environment_id`) REFERENCES `environments` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;' end down do run 'ALTER TABLE `nodes` DROP FOREIGN KEY `node_environment_id`;' run 'ALTER TABLE `nodes` DROP FOREIGN KEY `node_datacenter_id`;' end end