Timesheet System - Unit Testing & Quality Assurance
Timesheet System - Unit Testing & Quality Assurance
import YouTube from ’../../components/YouTube.jsx’;
General error: 1 no such column: timesheets.time_code_id
We saw this error at the end of Sprint 2 (around 5 minutes into the videp):
Let’s dive in. This error indicates a database schema mismatch. The error no such column: timesheets.time_code_id
means our code is trying to query a column named time_code_id
in the timesheets
table, but this column doesn’t actually exist in our SQLite database.
What did I do wrong?
One of the things I planned to check was that if the adminitrator creates a time code and then that time code is used in a timesheet, we obviously don’t want to delete the time code because that would break existing timesheets. Therefore this check in the Time Code Controller was designed to check if the code had been used before it allowed a deletion. However, when I put together the Timesheet Migration file, I forgot to add this column to my table and therefore this safety-net fails.