diff options
| author | hukl <hukl@eight.local> | 2009-02-02 23:25:15 +0100 |
|---|---|---|
| committer | hukl <hukl@eight.local> | 2009-02-02 23:25:15 +0100 |
| commit | 1c8bcc58d410db6d7eb5f1629813f08f78f47fa1 (patch) | |
| tree | 4b80c2b39ee2702e52ece2cbaaf507b0910b1437 /db/migrate | |
| parent | efbd264d62189ac6bbb80961ddef058240f16435 (diff) | |
add acts_as_taggable_on_steroids to replaces
custom flagging facilities
Diffstat (limited to 'db/migrate')
| -rw-r--r-- | db/migrate/20090202222400_acts_as_taggable_migration.rb | 26 |
1 files changed, 26 insertions, 0 deletions
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 @@ | |||
| 1 | class ActsAsTaggableMigration < ActiveRecord::Migration | ||
| 2 | def self.up | ||
| 3 | create_table :tags do |t| | ||
| 4 | t.column :name, :string | ||
| 5 | end | ||
| 6 | |||
| 7 | create_table :taggings do |t| | ||
| 8 | t.column :tag_id, :integer | ||
| 9 | t.column :taggable_id, :integer | ||
| 10 | |||
| 11 | # You should make sure that the column created is | ||
| 12 | # long enough to store the required class names. | ||
| 13 | t.column :taggable_type, :string | ||
| 14 | |||
| 15 | t.column :created_at, :datetime | ||
| 16 | end | ||
| 17 | |||
| 18 | add_index :taggings, :tag_id | ||
| 19 | add_index :taggings, [:taggable_id, :taggable_type] | ||
| 20 | end | ||
| 21 | |||
| 22 | def self.down | ||
| 23 | drop_table :taggings | ||
| 24 | drop_table :tags | ||
| 25 | end | ||
| 26 | end | ||
