DB Migration from 3.1 to 4.0 fails on PostgreSql
Created by: Philzen
Converted my SQLite installation to PostgreSql basically using this guide. This seems to have worked fine. Now i'm to upgrade from 3.1, which fails at DB Migration:
== MoveNoteableCommitToOwnField: migrating ===================================
-- add_column(:notes, :commit_id, :string, {:null=>true})
-> 0.0006s
-- add_column(:notes, :new_noteable_id, :integer, {:null=>true})
-> 0.0003s
rake aborted!
An error has occurred, this and all later migrations canceled:
PG::Error: ERROR: invalid input syntax for integer: ""
: UPDATE "notes" SET new_noteable_id = CAST (noteable_id AS INTEGER) WHERE (noteable_type != 'Commit')
/usr/home/gitlab/gitlab/vendor/bundle/ruby/1.9/gems/activerecord-3.2.9/lib/active_record/connection_adapters/postgresql_adapter.rb:1153:in `async_exec'
/usr/home/gitlab/gitlab/vendor/bundle/ruby/1.9/gems/activerecord-3.2.9/lib/active_record/connection_adapters/postgresql_adapter.rb:1153:in `exec_no_cache'
/usr/home/gitlab/gitlab/vendor/bundle/ruby/1.9/gems/activerecord-3.2.9/lib/active_record/connection_adapters/postgresql_adapter.rb:673:in `block in exec_delete'
/usr/home/gitlab/gitlab/vendor/bundle/ruby/1.9/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
Looking at the migration-file db/migrate/20121218164840_move_noteable_commit_to_own_field.rb
i cannot see a reason why this would fail other than rows with an empty notable_id
being selected.
Does this mean that something is broken in my database or is this a valid scenario that simply hasn't been thought of in the SQL?