Steps to re-create:
- create a policy. save
- edit the policy
- attach a control:
Illuminate\Database\QueryException
vendor/laravel/framework/src/Illuminate/Database/Connection.php:838
SQLSTATE[HY000]: General error: 1 ambiguous column name: id (Connection: sqlite, Database: /var/www/html/database/opengrc.sqlite, SQL: select distinct "id", "code", "title" from "controls" left join "control_policy" on "controls"."id" = "control_policy"."control_id" where not exists (select * from "policies" inner join "control_policy" on "policies"."id" = "control_policy"."policy_id" where "controls"."id" = "control_policy"."control_id" and "policies"."id" = 1 and "policies"."deleted_at" is null) and "controls"."deleted_at" is null limit 50)
- attach a risk
Illuminate\Database\QueryException
vendor/laravel/framework/src/Illuminate/Database/Connection.php:838
SQLSTATE[HY000]: General error: 1 ambiguous column name: id (Connection: sqlite, Database: /var/www/html/database/opengrc.sqlite, SQL: select distinct "id", "name" from "risks" left join "policy_risk" on "risks"."id" = "policy_risk"."risk_id" where not exists (select * from "policies" inner join "policy_risk" on "policies"."id" = "policy_risk"."policy_id" where "risks"."id" = "policy_risk"."risk_id" and "policies"."id" = 1 and "policies"."deleted_at" is null) limit 50)
- attach an implementation
Illuminate\Database\QueryException
vendor/laravel/framework/src/Illuminate/Database/Connection.php:838
SQLSTATE[HY000]: General error: 1 ambiguous column name: id (Connection: sqlite, Database: /var/www/html/database/opengrc.sqlite, SQL: select distinct "id", "title" from "implementations" left join "implementation_policy" on "implementations"."id" = "implementation_policy"."implementation_id" where not exists (select * from "policies" inner join "implementation_policy" on "policies"."id" = "implementation_policy"."policy_id" where "implementations"."id" = "implementation_policy"."implementation_id" and "policies"."id" = 1 and "policies"."deleted_at" is null) and "implementations"."deleted_at" is null limit 50)
it seems that the select clause needs to be using the table name as well, e.g. Select distinct implementation.id ...
in the Application Menu: Attaching implementations to applications
in the asset menu: attaching implementations to assets works.
in the implementation menu: attaching policies to implementations works
in the risk menu, attaching a policy to a risk works.
Steps to re-create:
it seems that the select clause needs to be using the table name as well, e.g. Select distinct implementation.id ...
in the Application Menu: Attaching implementations to applications
in the asset menu: attaching implementations to assets works.
in the implementation menu: attaching policies to implementations works
in the risk menu, attaching a policy to a risk works.