Sequel.migration do up do run "CREATE TABLE `task_logs` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `task_id` int(11) unsigned NOT NULL, `entry` text NOT NULL, `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), CONSTRAINT `task_log_task_id` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" end down do drop :task_logs end end