From 1c8bcc58d410db6d7eb5f1629813f08f78f47fa1 Mon Sep 17 00:00:00 2001 From: hukl Date: Mon, 2 Feb 2009 23:25:15 +0100 Subject: add acts_as_taggable_on_steroids to replaces custom flagging facilities --- .../20090202222400_acts_as_taggable_migration.rb | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 db/migrate/20090202222400_acts_as_taggable_migration.rb (limited to 'db') diff --git a/db/migrate/20090202222400_acts_as_taggable_migration.rb b/db/migrate/20090202222400_acts_as_taggable_migration.rb new file mode 100644 index 0000000..ea0c2cc --- /dev/null +++ b/db/migrate/20090202222400_acts_as_taggable_migration.rb @@ -0,0 +1,26 @@ +class ActsAsTaggableMigration < ActiveRecord::Migration + def self.up + create_table :tags do |t| + t.column :name, :string + end + + create_table :taggings do |t| + t.column :tag_id, :integer + t.column :taggable_id, :integer + + # You should make sure that the column created is + # long enough to store the required class names. + t.column :taggable_type, :string + + t.column :created_at, :datetime + end + + add_index :taggings, :tag_id + add_index :taggings, [:taggable_id, :taggable_type] + end + + def self.down + drop_table :taggings + drop_table :tags + end +end -- cgit v1.3