Migration AddOwnerToHosts fails with PostgreSQL
The database migration AddOwnerToHosts in db/migrate/20100419151910_add_owner_to_hosts.rb fails when being run with PostgreSQL as database.
$ rake db:migrate (in /usr/share/foreman) == AddOwnerToHosts: migrating ================================================ -- add_column(:hosts, :owner_id, :integer) -> 0.0026s -- add_column(:hosts, :owner_type, :string) -> 0.0007s -- setting default owner for all hosts rake aborted! An error has occurred, this and all later migrations canceled: PGError: ERROR: invalid input syntax for integer: "" : UPDATE "hosts" SET owner_id = '' (See full trace by running task with --trace)
The value of
owner.id, which is used in the migration, is not known at this stage of the migration.