Error after migrating from Katello 3.16 to 3.18 (Foreman 2.1 to 2.3.3)

Problem:
After migration, we got errors trying to perform some task, for example removing old content views. Every task we launch, we get it paused and we got this error message:

ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column hostgroups.kickstart_repository_id does not exist
LINE 1: …(SELECT “hostgroups”.“id” FROM “hostgroups” WHERE "hostgroup…

Expected outcome:
Content views removed

Foreman and Proxy versions:

  • foreman-2.3.3-1.el7.noarch
  • foreman-proxy-2.3.3-1.el7.noarch
  • katello-3.18.1-1.el7.noarch

Foreman and Proxy plugin versions:

Distribution and version:
Rhel 7.9

Other relevant data:

Hi @leot,

Is there more to that error in your logs or perhaps in the Dynflow console of your paused tasks? A backtrace with the location of the errored code would be helpful, if available.