Project

General

Profile

Actions

Bug #34994

closed

"ERROR: relation "application_records" does not exist" when using models inside migrations

Added by Evgeni Golov almost 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Database
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

The changes from #34305 made `ApplicationRecord` not being loaded early enough to properly work inside of DB migrations that rely on real models (vs fake ones as often used in core)

example failure from the installation:

2022-05-27 22:14:48 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: PG::UndefinedTable: ERROR:  relation "application_records" does not exist
2022-05-27 22:14:48 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: LINE 1: DELETE FROM "application_records" WHERE "application_records...
2022-05-27 22:14:48 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns:                     ^
2022-05-27 22:14:48 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: /usr/share/gems/gems/activerecord-6.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:672:in `async_exec_params'
…
2022-05-27 22:14:48 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: /usr/share/gems/gems/foreman_puppet-4.0.0/db/migrate_foreman/20161205142618_delete_orphaned_smart_class_parameters.foreman_puppet.rb:4:in `up'


Related issues 1 (0 open1 closed)

Related to Foreman - Refactor #34305: Stop creating settings in the DBClosedOndřej EzrActions
Actions #1

Updated by Evgeni Golov almost 2 years ago

Actions #2

Updated by The Foreman Bot almost 2 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/9244 added
Actions #3

Updated by The Foreman Bot almost 2 years ago

  • Fixed in Releases 3.4.0 added
Actions #4

Updated by Evgeni Golov almost 2 years ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF