我安装了mailman服务器来接收电子邮件。然后我运行命令
bundle exec script/mailman_server start
阅读电子邮件。每当我运行此命令时,它都会访问我的开发DB。但我想访问我的测试数据库。所以我改变了我的命令bundle exec script/mailman_server start --environment=test
。
现在,此命令在测试模式下运行。但它无法访问我的测试数据库。相反,它会抛出一些错误,如
Mysql2::Error: Cannot add or update a child row: a foreign key constraint fails (`cd_dashboard_dev`.`data_uats`, CONSTRAINT `data_uat_f_project_id` FOREIGN KEY (`project_id`) REFERENCES `projects` (`project_id`)): INSERT INTO `data_uats` (`build_no`, `company_id`, `created_at`, `critical_defects`, `high_defects`, `low_defects`, `medium_defects`, `project_id`, `release_cycle_no`, `test_date`, `updated_at`) VALUES ('B_2', 1, '2014-12-16 04:59:08', 3, 4, 5, 5, 31, '1', '2014-12-16', '2014-12-16 04:59:08') (ActiveRecord::InvalidForeignKey)
任何人都知道我为什么会收到这个MySQL错误?请帮忙。这是一种紧急情况。任何帮助将不胜感激。提前致谢