1

I installed mailman server to receive emails. and then I run the command

bundle exec script/mailman_server start

to read emails. It access my development DB whenever I run this command. But I want to access my test DB. so I changed my command like bundle exec script/mailman_server start --environment=test. Now this command runs in test mode. But it does not access my test DB. instead, it throws some error like

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)

Anyone knows why I am getting this MySQL error? please help. It is kind of emergency. Any help would be grateful. Thanks in advance

Anitha
  • 1,045
  • 3
  • 18
  • 31
  • http://stackoverflow.com/a/16140283/2231236 – Nithin Dec 16 '14 at 05:21
  • Hi nithin..this is not my cup of tea...that means i'm just accessing test DB through the command "bundle exec script/mailman_server start --environment=test". So it should take test DB only..but really it is not taking test DB. this is the problem i have now. Hope you understand – Anitha Dec 16 '14 at 06:16
  • Hurray ..got an answer..run RAILS=ENV bundle exec script/mailman_server start – Anitha Dec 24 '14 at 04:37

0 Answers0