Project

General

Profile

Actions

Bug #465

closed

Migration AddOwnerToHosts fails with PostgreSQL

Added by Jochen Schalanda over 13 years ago. Updated about 13 years ago.

Status:
Closed
Priority:
Normal
Category:
DB migrations
Target version:
Difficulty:
Triaged:
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.


Files

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
Actions #1

Updated by Ohad Levy over 13 years ago

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

Actions #2

Updated by Ohad Levy about 13 years ago

  • Target version set to 0.2
Actions #3

Updated by Ohad Levy about 13 years ago

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

Also available in: Atom PDF