Skip to content

Instantly share code, notes, and snippets.

@masom
Created July 27, 2011 04:37
Show Gist options
  • Save masom/1108684 to your computer and use it in GitHub Desktop.
Save masom/1108684 to your computer and use it in GitHub Desktop.
rake db:migrate using MonetDB
#Migration files:
class CreateCategory < ActiveRecord::Migration
def self.up
create_table :categories do |t|
t.string :name
t.timestamps
end
end
def self.down
drop_table :categories
end
end
class CreateRecipe < ActiveRecord::Migration
def self.up
create_table :recipes do |t|
t.string :name
t.string :slug
t.integer :rating
t.references :category
t.integer :prep_time
t.integer :cook_time
t.integer :servings
t.string :steps
t.timestamps
end
end
def self.down
drop_table :recipes
end
end
Output:
** Invoke db:migrate (first_time)
** Invoke db:configure_connection (first_time)
** Invoke db:configuration (first_time)
** Invoke db:environment (first_time)
** Execute db:environment
** Execute db:configuration
** Execute db:configure_connection
** Execute db:migrate
I, [2011-07-27T00:12:01.004411 #6429] INFO -- : Migrating to CreateCategory (0)
== CreateCategory: migrating =================================================
-- create_table(:categories)
-> 0.0534s
== CreateCategory: migrated (0.0537s) ========================================
rake aborted!
An error has occurred, all later migrations canceled:
undefined method `relation' for nil:NilClass
/usr/lib/ruby/gems/1.8/gems/arel-2.0.10/lib/arel/insert_manager.rb:22:in `insert'
/usr/lib/ruby/gems/1.8/gems/arel-2.0.10/lib/arel/crud.rb:26:in `insert'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/migration.rb:598:in `record_version_state_after_migrating'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/migration.rb:540:in `migrate'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/migration.rb:615:in `call'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/migration.rb:615:in `ddl_transaction'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/migration.rb:538:in `migrate'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/migration.rb:525:in `each'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/migration.rb:525:in `migrate'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/migration.rb:435:in `up'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.9/lib/active_record/migration.rb:417:in `migrate'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment