diff options
| author | mo khan <mo@mokhan.ca> | 2014-08-21 21:29:43 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-08-21 21:29:43 -0600 |
| commit | 9ee219bb26a93d9adb233c5234845b5ca68ec194 (patch) | |
| tree | ace2f339371602f7c5b77b6b4454fbd0d3f861db /db | |
| parent | 7a1927be8f7958414e38b3b4f8cb0901aad83e3a (diff) | |
upgrade to rails 4.1
Diffstat (limited to 'db')
4 files changed, 51 insertions, 3 deletions
diff --git a/db/migrate/20140822032548_add_missing_unique_indices.acts_as_taggable_on_engine.rb b/db/migrate/20140822032548_add_missing_unique_indices.acts_as_taggable_on_engine.rb new file mode 100644 index 00000000..4ca676f6 --- /dev/null +++ b/db/migrate/20140822032548_add_missing_unique_indices.acts_as_taggable_on_engine.rb @@ -0,0 +1,20 @@ +# This migration comes from acts_as_taggable_on_engine (originally 2) +class AddMissingUniqueIndices < ActiveRecord::Migration + def self.up + add_index :tags, :name, unique: true + + remove_index :taggings, :tag_id + remove_index :taggings, [:taggable_id, :taggable_type, :context] + add_index :taggings, + [:tag_id, :taggable_id, :taggable_type, :context, :tagger_id, :tagger_type], + unique: true, name: 'taggings_idx' + end + + def self.down + remove_index :tags, :name + + remove_index :taggings, name: 'taggings_idx' + add_index :taggings, :tag_id + add_index :taggings, [:taggable_id, :taggable_type, :context] + end +end diff --git a/db/migrate/20140822032549_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20140822032549_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb new file mode 100644 index 00000000..8edb5080 --- /dev/null +++ b/db/migrate/20140822032549_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb @@ -0,0 +1,15 @@ +# This migration comes from acts_as_taggable_on_engine (originally 3) +class AddTaggingsCounterCacheToTags < ActiveRecord::Migration + def self.up + add_column :tags, :taggings_count, :integer, default: 0 + + ActsAsTaggableOn::Tag.reset_column_information + ActsAsTaggableOn::Tag.find_each do |tag| + ActsAsTaggableOn::Tag.reset_counters(tag.id, :taggings) + end + end + + def self.down + remove_column :tags, :taggings_count + end +end diff --git a/db/migrate/20140822032550_add_missing_taggable_index.acts_as_taggable_on_engine.rb b/db/migrate/20140822032550_add_missing_taggable_index.acts_as_taggable_on_engine.rb new file mode 100644 index 00000000..71f2d7f4 --- /dev/null +++ b/db/migrate/20140822032550_add_missing_taggable_index.acts_as_taggable_on_engine.rb @@ -0,0 +1,10 @@ +# This migration comes from acts_as_taggable_on_engine (originally 4) +class AddMissingTaggableIndex < ActiveRecord::Migration + def self.up + add_index :taggings, [:taggable_id, :taggable_type, :context] + end + + def self.down + remove_index :taggings, [:taggable_id, :taggable_type, :context] + end +end diff --git a/db/schema.rb b/db/schema.rb index 41f0268a..5015beca 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140816190202) do +ActiveRecord::Schema.define(version: 20140822032550) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -134,16 +134,19 @@ ActiveRecord::Schema.define(version: 20140816190202) do t.datetime "created_at" end - add_index "taggings", ["tag_id"], name: "index_taggings_on_tag_id", using: :btree + add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true, using: :btree add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree add_index "taggings", ["taggable_type"], name: "index_taggings_on_taggable_type", using: :btree add_index "taggings", ["tagger_id"], name: "index_taggings_on_tagger_id", using: :btree add_index "taggings", ["tagger_type"], name: "index_taggings_on_tagger_type", using: :btree create_table "tags", force: true do |t| - t.string "name" + t.string "name" + t.integer "taggings_count", default: 0 end + add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree + create_table "tutorials", force: true do |t| t.string "heading" t.text "description" |
