Project

General

Profile

Bug #14983

Faking host and other models with STI in migrations doesn't work due to STI

Added by Ivan Necas almost 3 years ago. Updated almost 3 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
DB migrations
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

We often use the fake classes in our migrations to avoid the issues with the real active record models when
the data are not migrated fully yet + some hooks might trigger orchestration.

This approach fails with `Host` and other STI objects, as it loads the class based on the `type` attribute
(see related issues).

We should provide a standard way how to do the data manipulations safely without risking unexpected issues.

Often the errors doesn't show immediately in isolation, but rather when multiple plugins are in place.


Related issues

Related to Katello - Bug #14982: host description migration goes throuh unfaked-host validationsClosed2016-05-10
Related to Discovery - Bug #14643: Migration broken with discovered hostsClosed2016-04-14
Related to Foreman - Bug #15038: migrate_foreman error upgrading from 6.1 to 6.2 -> error: users.helptips_enabled does not existClosed2016-05-12
Related to Foreman - Refactor #15866: Provide alternative way of migrating data as oposed misuing db:migrate for this purposeNew2016-07-27
Related to Discovery - Bug #21609: Migrations on clean db with rails 5 failsNew2017-11-09

History

#1 Updated by Ivan Necas almost 3 years ago

  • Related to Bug #14982: host description migration goes throuh unfaked-host validations added

#2 Updated by Ivan Necas almost 3 years ago

  • Related to Bug #14643: Migration broken with discovered hosts added

#3 Updated by Ivan Necas almost 3 years ago

  • Subject changed from Faking host in migrations doesn't work due to STI to Faking host and other modedels with STI in migrations doesn't work due to STI

#4 Updated by Dominic Cleal almost 3 years ago

  • Category set to DB migrations

#5 Updated by Ivan Necas almost 3 years ago

  • Subject changed from Faking host and other modedels with STI in migrations doesn't work due to STI to Faking host and other models with STI in migrations doesn't work due to STI
  • Category deleted (DB migrations)

#6 Updated by Dominic Cleal almost 3 years ago

  • Category set to DB migrations

#7 Updated by Ivan Necas almost 3 years ago

  • Related to Bug #15038: migrate_foreman error upgrading from 6.1 to 6.2 -> error: users.helptips_enabled does not exist added

#8 Updated by Ivan Necas over 2 years ago

  • Related to Refactor #15866: Provide alternative way of migrating data as oposed misuing db:migrate for this purpose added

#9 Updated by Ori Rabin over 1 year ago

  • Related to Bug #21609: Migrations on clean db with rails 5 fails added

Also available in: Atom PDF