diff --git a/spec/dummy/db/migrate/20141119205155_add_published_at_to_alchemy_pages.alchemy.rb b/spec/dummy/db/migrate/20141119205155_add_published_at_to_alchemy_pages.alchemy.rb new file mode 100644 index 0000000..d0af0d3 --- /dev/null +++ b/spec/dummy/db/migrate/20141119205155_add_published_at_to_alchemy_pages.alchemy.rb @@ -0,0 +1,6 @@ +# This migration comes from alchemy (originally 20130918201742) +class AddPublishedAtToAlchemyPages < ActiveRecord::Migration + def change + add_column :alchemy_pages, :published_at, :timestamp + end +end diff --git a/spec/dummy/db/migrate/20141119205156_add_missing_unique_indices_to_tags_and_taggings.alchemy.rb b/spec/dummy/db/migrate/20141119205156_add_missing_unique_indices_to_tags_and_taggings.alchemy.rb new file mode 100644 index 0000000..6dca4d9 --- /dev/null +++ b/spec/dummy/db/migrate/20141119205156_add_missing_unique_indices_to_tags_and_taggings.alchemy.rb @@ -0,0 +1,22 @@ +# This migration comes from alchemy (originally 20140107192720) +class AddMissingUniqueIndicesToTagsAndTaggings < 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: 'tagging_idx' + add_index :taggings, :tag_id + add_index :taggings, [:taggable_id, :taggable_type, :context] + end + +end diff --git a/spec/dummy/db/migrate/20141119205157_add_taggings_counter_cache_to_tags.alchemy.rb b/spec/dummy/db/migrate/20141119205157_add_taggings_counter_cache_to_tags.alchemy.rb new file mode 100644 index 0000000..256903e --- /dev/null +++ b/spec/dummy/db/migrate/20141119205157_add_taggings_counter_cache_to_tags.alchemy.rb @@ -0,0 +1,15 @@ +# This migration comes from alchemy (originally 20140701160159) +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 \ No newline at end of file diff --git a/spec/dummy/db/migrate/20141119205158_add_missing_taggable_index.alchemy.rb b/spec/dummy/db/migrate/20141119205158_add_missing_taggable_index.alchemy.rb new file mode 100644 index 0000000..abef1d9 --- /dev/null +++ b/spec/dummy/db/migrate/20141119205158_add_missing_taggable_index.alchemy.rb @@ -0,0 +1,10 @@ +# This migration comes from alchemy (originally 20140701160225) +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/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb index ab7a845..99eb58c 100644 --- a/spec/dummy/db/schema.rb +++ b/spec/dummy/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: 20131225232042) do +ActiveRecord::Schema.define(version: 20141119205158) do create_table "alchemy_attachments", force: true do |t| t.string "name" @@ -232,6 +232,7 @@ t.integer "updater_id" t.integer "language_id" t.text "cached_tag_list" + t.datetime "published_at" end add_index "alchemy_pages", ["language_id"], name: "index_pages_on_language_id" @@ -326,11 +327,14 @@ t.datetime "created_at" end - add_index "taggings", ["tag_id"], name: "index_taggings_on_tag_id" + add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context" 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 + end