Hello all,

I'm having a problem with DataMapper and Heroku. I'm sure it's more of
a Heroku problem than a DataMapper problem but maybe someone here can
help.

I have a Sinatra app that uses DataMapper. (I'm quite new to both
technologies.) It works fine in development but in production I'm
getting two annoying errors.

1. Heroku uses Postgres by default. DataMapper doesn't seem to be
setting the length of the columns. I'm getting errors on String and
Text. Postgres is complaining about them being varying(50). Well, Text
should be a Text column and String should be varying(150).

2. My db gets trashed after a while (when you visit the app after
Heroku spins down). By trashed I mean its gone. No database exists.

My code is

require 'rubygems'
require 'sinatra'
require 'dm-core'
require 'dm-timestamps'

configure :production do
  DataMapper::setup(:default, ENV['DATABASE_URL'])
end

configure :development do
  DataMapper::setup(:default, "sqlite3://#{Dir.pwd}/languages.db")
  DataMapper.auto_upgrade!
end


class Language
  include DataMapper::Resource

  property :id,             Serial
  property :name,           String
  property :used_for,       Text
  property :home_page,      String, :length => 150
  property :wiki,           String, :length => 150
  property :appeared,       Integer
  property :gist,           Text
  property :share_link,     String
  property :created_at,     DateTime
  property :updated_at,     DateTime

end

Does anything here look out of place? Like I said, it all works
perfectly in development.

I also get these weird error messages from Heroku when I try to run
DataMapper.auto_migrate! and DateMapper.auto_upgrade!

>> DataMapper.auto_upgrade!
NoMethodError: undefined method `quote_value' for
#<DataObjects::Postgres::Connection:0x2b9748e7a260>


Thanks

David

--

You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to datamap...@googlegroups.com.
To unsubscribe from this group, send email to 
datamapper+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.


Reply via email to