On 01/10/11 17:00, CharlieMagee wrote:
Thanks Matt. I wasn't sure where Rails ends and Hobo starts, so I kept
trying to use a Hobo command and kept getting errors. So I followed
your advice and found the rails "rake db:rollback STEP=n" command.
That did the trick.
Charlie
On Oct 1, 2:30 pm, Matt Jones<[email protected]> wrote:
Not at all - this is an area where Hobo doesn't add much of anything. Check
into the Rails documentation for migrations, but try just running the migration
generator (hobo generate migration) first, as it should detect tables that
don't have associated models and ask if you want to drop them.
--Matt Jones
In Hobo 1.3.0.RC2 I ran the following commands as per Owen's Tutorial # 1:
hobo new my_first_app
hobo generate resource contact name:string company:string
hobo g migration
gedit app/models/contact.rb (added address1, address2, city, state,
date_met, married and state)
hobo g migration
gedit app/models/contact.rb (commented address2)
hobo g migration
rm app/models/contact.rb
rm app/controllers/contacts_controller.rb
rm app/helpers/contact_helper.rb
hobo g migration
I tryed to rollback to a previous migration with:
rake db:migrate VERSION=20111024192624_hobo_migration_1
== HoboMigration4: reverting
=================================================
-- create_table("contacts", {:force=>true})
-> 0.0053s
== HoboMigration4: reverted (0.0059s)
========================================
== HoboMigration3: reverting
=================================================
-- add_column(:contacts, :address2, :string)
-> 0.0023s
== HoboMigration3: reverted (0.0029s)
========================================
== HoboMigration2: reverting
=================================================
-- remove_column(:contacts, :address1)
-> 0.2566s
-- remove_column(:contacts, :address2)
-> 0.2374s
-- remove_column(:contacts, :city)
-> 0.3238s
-- remove_column(:contacts, :state)
-> 0.2500s
-- remove_column(:contacts, :date_met)
-> 0.2472s
-- remove_column(:contacts, :married)
-> 0.0905s
-- remove_column(:contacts, :age)
-> 0.1815s
-- remove_column(:contacts, :notes)
-> 0.2062s
== HoboMigration2: reverted (1.7991s)
========================================
The contents of 20111024192624_hobo_migration_1.rb:
class HoboMigration1 < ActiveRecord::Migration
def self.up
create_table :contacts do |t|
t.string :name
t.string :company
t.datetime :created_at
t.datetime :updated_at
end
end
def self.down
drop_table :contacts
end
end
and it would not apppear contactrb at app/models/
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.