Skip to content

Instantly share code, notes, and snippets.

@comboy
Created April 18, 2011 11:05
Show Gist options
  • Save comboy/925141 to your computer and use it in GitHub Desktop.
Save comboy/925141 to your computer and use it in GitHub Desktop.
model def
irb(main):004:0> Mol::TimeLog.auto_upgrade!
DataObjects::SyntaxError: ERROR: syntax error at or near "PRIMARY"
LINE 1: CREATE TABLE "time_logs" ( SERIAL PRIMARY KEY, "ttype" VARCH...
^
(code: 16801924, sql state: 42601, query: CREATE TABLE "time_logs" ( SERIAL PRIMARY KEY, "ttype" VARCHAR(255), "log" TEXT, "created_at" TIMESTAMP, PRIMARY KEY("id")), uri: postgres://mol:justatest@bzibm/mol?port=&adapter=postgres&fragment=&scheme=postgres&path=/mol&host=bzibm&user=mol&password=justatest&query=)
from /comboy/projects/mol/.bunndle/ruby/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-do-adapter.rb:100:in `execute_non_query'
from /comboy/projects/mol/.bunndle/ruby/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-do-adapter.rb:100:in `create_model_storage'
from /comboy/projects/mol/.bunndle/ruby/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-do-adapter.rb:98:in `each'
from /comboy/projects/mol/.bunndle/ruby/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-do-adapter.rb:98:in `create_model_storage'
from /comboy/projects/mol/.bunndle/ruby/1.8/gems/dm-do-adapter-1.1.0/lib/dm-do-adapter/adapter.rb:276:in `with_connection'
from /comboy/projects/mol/.bunndle/ruby/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-do-adapter.rb:93:in `create_model_storage'
from /comboy/projects/mol/.bunndle/ruby/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-postgres-adapter.rb:23:in `create_model_storage'
from /comboy/projects/mol/.bunndle/ruby/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-postgres-adapter.rb:58:in `without_notices'
from /comboy/projects/mol/.bunndle/ruby/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-postgres-adapter.rb:23:in `create_model_storage'
from /comboy/projects/mol/.bunndle/ruby/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-do-adapter.rb:57:in `upgrade_model_storage'
from /comboy/projects/mol/.bunndle/ruby/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-postgres-adapter.rb:18:in `upgrade_model_storage'
from /comboy/projects/mol/.bunndle/ruby/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-postgres-adapter.rb:58:in `without_notices'
from /comboy/projects/mol/.bunndle/ruby/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-postgres-adapter.rb:18:in `upgrade_model_storage'
require 'dm-timestamps'
module Mol
class TimeLog
include DataMapper::Resource
property :id, Serial
property :ttype, String, :length => 255, :index => true
property :log, Text
property :created_at, DateTime
def self.add(ttype, log)
create(:ttype => ttype.to_s, :log => log)
end
def self.storage_name(repo_name)
"time_logs"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment