summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20090815220058_migrate_tagging_tables.rb29
1 files changed, 10 insertions, 19 deletions
diff --git a/db/migrate/20090815220058_migrate_tagging_tables.rb b/db/migrate/20090815220058_migrate_tagging_tables.rb
index 59e054f..e28a16e 100644
--- a/db/migrate/20090815220058_migrate_tagging_tables.rb
+++ b/db/migrate/20090815220058_migrate_tagging_tables.rb
@@ -3,27 +3,18 @@ class MigrateTaggingTables < ActiveRecord::Migration
3 add_column :tags, :taggings_count, :integer, :default => 0, :null => false 3 add_column :tags, :taggings_count, :integer, :default => 0, :null => false
4 add_column :taggings, :user_id, :integer 4 add_column :taggings, :user_id, :integer
5 5
6 add_index :tags, :name 6 add_index :tags, :name
7 add_index :tags, :taggings_count 7 add_index :tags, :taggings_count
8 8 add_index :taggings, [:user_id, :tag_id, :taggable_type]
9 Find objects for a tag 9 add_index :taggings, [:user_id, :taggable_id, :taggable_type]
10 add_index :taggings, [:user_id, :tag_id, :taggable_type]
11
12 Find tags for an object
13 add_index :taggings, [:user_id, :taggable_id, :taggable_type]
14 end 10 end
15 11
16 def self.down 12 def self.down
17 remove_column :tags, :taggings_count 13 remove_column :tags, :taggings_count
18 remove_column :taggings, :user_id 14 remove_column :taggings, :user_id
19 15 remove_index :tags, :name
20 remove_index :tags, :name 16 remove_index :tags, :taggings_count
21 remove_index :tags, :taggings_count 17 remove_index :taggings, [:user_id, :tag_id, :taggable_type]
22 18 remove_index :taggings, [:user_id, :taggable_id, :taggable_type]
23 # Find objects for a tag
24 remove_index :taggings, [:user_id, :tag_id, :taggable_type]
25
26 # Find tags for an object
27 remove_index :taggings, [:user_id, :taggable_id, :taggable_type]
28 end 19 end
29end 20end