Project

General

Profile

Bug #465

Migration AddOwnerToHosts fails with PostgreSQL

Added by Jochen Schalanda over 8 years ago. Updated over 8 years ago.

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

Description

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.

0001-Fixed-465-Use-correct-condition-in-migration-AddOwne.patch 0001-Fixed-465-Use-correct-condition-in-migration-AddOwne.patch 1.08 KB Proposed trivial patch, tested against PostgreSQL. Jochen Schalanda, 11/14/2010 09:53 AM

History

#1 Updated by Ohad Levy over 8 years ago

but this will just skip the migration in this case - right?

#2 Updated by Ohad Levy over 8 years ago

  • Target version set to 0.2

#3 Updated by Ohad Levy over 8 years ago

  • Status changed from New to Closed
  • Priority changed from Low to Normal

Also available in: Atom PDF