adanot
adanot

Reputation: 328

Rails database migration failing because of Postgres inet type

I have a Rails(4.1.0) app that works fine on Heroku. However, on my local machine, rake db:migrate fails due to a table for devise that uses inet datatype and I am using sqlite3 for testing.

I have included the postgres gem as well as postgres_ext but still coming up with the error:

undefined method `inet' for #<ActiveRecord::ConnectionAdapters::Table:0x00000005fae9e8>/home/app/db/migrate/20141107192501_add_devise_to_users.rb:19:in `block in up'

Upvotes: 2

Views: 1138

Answers (1)

max
max

Reputation: 102250

If testing locally using Postgres is acceptable just setup the correct adapters. A sample database.yml:

common: &common
  adapter: postgresql
  encoding: utf8
  template: template0 # Required for UTF8 encoding
  username: <%= ENV["POSTGRES_USER"] %>
  password: <%= ENV["POSTGRES_PASSWORD"] %>
  host: <%= ENV["POSTGRES_HOST"] %>

development:
  <<: *common
  database: 'my_app_dev'

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  <<: *common
  database: 'my_app_test'

Upvotes: 2

Related Questions