toy / dump

Rails app rake and capistrano tasks to create and restore dumps of database and assets
MIT License
89 stars 14 forks source link

Recieve message: 'invalid input syntax for type inet' #19

Open astery opened 9 years ago

astery commented 9 years ago

I have devise based users table with couple inet fields.

  create_table "users", force: :cascade do |t|
    ...
    t.datetime "last_sign_in_at"
    t.inet     "current_sign_in_ip"
    t.inet     "last_sign_in_ip"
    t.string   "confirmation_token"
    ...
  end

Then I try to restore database I recieve error:

ActiveRecord::StatementInvalid: PG::InvalidTextRepresentation: ERROR:  invalid input syntax for type inet: "--- !ruby/object:IPAddr
family: 2
addr: 1539998154
mask_addr: 4294967295
"

Environment: rails 4.2.0, ruby 2.0.0p598, dump 1.1.0, PostgreSQL 9.3.6

toy commented 9 years ago

Interesting one. It seems that some conversion is missing: either it should not be dumped as IPAddr object or should be converted before trying to restore it. I'm short on time, so PR is very welcome :)