运行 迁移时出现问题,但通过控制台可以正常工作
Getting Issue when running migration but through console its works
当我 运行 通过迁移查询时,它给出了错误-
查询-
ActionEvent.includes([:historic_task_allocation, {:task_results =>[:task_result_status, :user]}]).where("action_events.ae_type = 0 AND action_events.result_status <> 2 AND task_result_statuses.is_completion AND users.id NOT IN (SELECT user_id FROM allocation_user_links aul WHERE aul.task_allocation_id = task_allocations.id AND aul.valid_from < action_events.date AND (aul.valid_to > action_events.date OR aul.valid_to IS NULL))")
错误-
Mysql2::Error: Unknown column 'task_allocations.can_complete_late' in
'field list':
但是通过控制台它的工作。
问题出在哪里?
通过在 self.up 方法中的查询上方添加以下行解决了此问题。
TaskAllocation.reset_column_information # Resets all the cached information about columns, which will cause them to be reloaded on the next request.
当我 运行 通过迁移查询时,它给出了错误-
查询-
ActionEvent.includes([:historic_task_allocation, {:task_results =>[:task_result_status, :user]}]).where("action_events.ae_type = 0 AND action_events.result_status <> 2 AND task_result_statuses.is_completion AND users.id NOT IN (SELECT user_id FROM allocation_user_links aul WHERE aul.task_allocation_id = task_allocations.id AND aul.valid_from < action_events.date AND (aul.valid_to > action_events.date OR aul.valid_to IS NULL))")
错误-
Mysql2::Error: Unknown column 'task_allocations.can_complete_late' in 'field list':
但是通过控制台它的工作。
问题出在哪里?
通过在 self.up 方法中的查询上方添加以下行解决了此问题。
TaskAllocation.reset_column_information # Resets all the cached information about columns, which will cause them to be reloaded on the next request.