Running mix cadet.token <role> results in the following Ecto.QueryError:
** (Ecto.QueryError) lib/mix/tasks/token.ex:65: field `role` in `where` does not exist in schema Cadet.Accounts.User in query:
from u0 in Cadet.Accounts.User,
where: u0.role == ^"student",
order_by: [asc: u0.id],
limit: 1,
select: u0
Steps to Reproduce
- Clone the
master branch of the backend repository.
- Setup the local development environment, as per the "Setting up your local development environment" section of the README.
- Run
mix cadet.token <role>
Root Cause
The 20210531155751_multitenant_upgrade.exs migration removes the 'role' column from the 'users' table (it is shifted to the 'courses' table). The User schema has been similarly updated to remove the 'role' field.
Proposed Fix
The query in the test_user function in lib/mix/tasks/token.ex can be updated to include a join clause between the 'users' and 'courses' table.
Running
mix cadet.token <role>results in the following Ecto.QueryError:Steps to Reproduce
masterbranch of the backend repository.mix cadet.token <role>Root Cause
The
20210531155751_multitenant_upgrade.exsmigration removes the 'role' column from the 'users' table (it is shifted to the 'courses' table). The User schema has been similarly updated to remove the 'role' field.Proposed Fix
The query in the test_user function in lib/mix/tasks/token.ex can be updated to include a join clause between the 'users' and 'courses' table.