Displaying 3 results from an estimated 3 matches for "drop_versioned_t".
2007 Mar 25
1
Can't use models in migrations
...s AddVersions < ActiveRecord::Migration
# def self.up
# # create_versioned_table takes the same options hash
# # that create_table does
# Post.create_versioned_table
# end
#
# def self.down
# Post.drop_versioned_table
# end
# end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org...
2006 May 17
0
acts_as_versioned with lock_version bug?
...:force => true do |t|
t.column :name, :string, :limit => 20, :null => false
t.column :version, :integer, :default => 0, :null => false
end
Software.create_versioned_table
end
def self.down
drop_table :softwares
Software.drop_versioned_table
end
end
% rake migrate
(in /home/krassi/MyProjects/Rails/pl2)
== CreateTables: migrating
====================================================
-- create_table(:softwares, {:force=>true})
-> 0.0218s
== CreateTables: migrated (0.0589s)
================...
2006 Aug 13
3
+ migrations in camping
...p
create_table :tepee_pages, :force => true do |t|
t.column :title, :string, :limit => 255
t.column :body, :text
end
Tepee::Models::Page.create_versioned_table
end
def self.down
drop_table :tepee_pages
Tepee::Models::Page.drop_versioned_table
end
end
end
This is only a very light bit of syntax on top of what ActiveRecord already
does. If you''re not familiar with the up/down methods and how migrations work,
I''d look into the AR docs[1].
Basically, this class is identifying itself as version 1.0 of the...