From ddf3bd6b380f59b2524ce64213d64f37a7b912d1 Mon Sep 17 00:00:00 2001 From: aaronzdavis Date: Thu, 10 Mar 2016 20:13:27 -0800 Subject: [PATCH] Update dependancies and update acts as taggable on to 3.5.0 --- Gemfile | 2 +- ...20130128124852_acts_as_taggable_on_migration.rb | 8 ++++---- .../20140901055150_add_missing_unique_indices.rb | 8 ++++---- ...901055151_add_taggings_counter_cache_to_tags.rb | 14 ++++++++++++++ .../20140901055152_add_missing_taggable_index.rb | 9 +++++++++ ...0140901055153_change_collation_for_tag_names.rb | 9 +++++++++ spree_blogging_spree.gemspec | 4 ++-- 7 files changed, 43 insertions(+), 11 deletions(-) create mode 100644 db/migrate/20140901055151_add_taggings_counter_cache_to_tags.rb create mode 100644 db/migrate/20140901055152_add_missing_taggable_index.rb create mode 100644 db/migrate/20140901055153_change_collation_for_tag_names.rb diff --git a/Gemfile b/Gemfile index 244582e6..e8ad34b7 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -gem 'spree', github: 'spree/spree', branch: '3-0-stable' +gem 'spree_core', '3.0.6.1' gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '3-0-stable' gemspec diff --git a/db/migrate/20130128124852_acts_as_taggable_on_migration.rb b/db/migrate/20130128124852_acts_as_taggable_on_migration.rb index e8b978d9..db191447 100644 --- a/db/migrate/20130128124852_acts_as_taggable_on_migration.rb +++ b/db/migrate/20130128124852_acts_as_taggable_on_migration.rb @@ -9,12 +9,12 @@ def self.up # You should make sure that the column created is # long enough to store the required class names. - t.references :taggable, :polymorphic => true - t.references :tagger, :polymorphic => true + t.references :taggable, polymorphic: true + t.references :tagger, polymorphic: true # Limit is created to prevent MySQL error on index # length for MyISAM table type: http://bit.ly/vgW2Ql - t.string :context, :limit => 128 + t.string :context, limit: 128 t.datetime :created_at end @@ -27,4 +27,4 @@ def self.down drop_table :taggings drop_table :tags end -end +end \ No newline at end of file diff --git a/db/migrate/20140901055150_add_missing_unique_indices.rb b/db/migrate/20140901055150_add_missing_unique_indices.rb index 260444c1..5ff25006 100644 --- a/db/migrate/20140901055150_add_missing_unique_indices.rb +++ b/db/migrate/20140901055150_add_missing_unique_indices.rb @@ -5,9 +5,9 @@ def self.up 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 + [:tag_id, :taggable_id, :taggable_type, :context, :tagger_id, :tagger_type], + unique: true, name: 'taggings_idx' + end def self.down remove_index :tags, :name @@ -16,4 +16,4 @@ def self.down add_index :taggings, :tag_id add_index :taggings, [:taggable_id, :taggable_type, :context] end -end +end \ No newline at end of file diff --git a/db/migrate/20140901055151_add_taggings_counter_cache_to_tags.rb b/db/migrate/20140901055151_add_taggings_counter_cache_to_tags.rb new file mode 100644 index 00000000..cfd2edce --- /dev/null +++ b/db/migrate/20140901055151_add_taggings_counter_cache_to_tags.rb @@ -0,0 +1,14 @@ +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/db/migrate/20140901055152_add_missing_taggable_index.rb b/db/migrate/20140901055152_add_missing_taggable_index.rb new file mode 100644 index 00000000..336c9e24 --- /dev/null +++ b/db/migrate/20140901055152_add_missing_taggable_index.rb @@ -0,0 +1,9 @@ +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 \ No newline at end of file diff --git a/db/migrate/20140901055153_change_collation_for_tag_names.rb b/db/migrate/20140901055153_change_collation_for_tag_names.rb new file mode 100644 index 00000000..c5bb00cc --- /dev/null +++ b/db/migrate/20140901055153_change_collation_for_tag_names.rb @@ -0,0 +1,9 @@ +# This migration is added to circumvent issue #623 and have special characters +# work properly +class ChangeCollationForTagNames < ActiveRecord::Migration + def up + if ActsAsTaggableOn::Utils.using_mysql? + execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;") + end + end +end \ No newline at end of file diff --git a/spree_blogging_spree.gemspec b/spree_blogging_spree.gemspec index fb0d3774..7a3c6f22 100644 --- a/spree_blogging_spree.gemspec +++ b/spree_blogging_spree.gemspec @@ -16,8 +16,8 @@ Gem::Specification.new do |s| s.require_path = 'lib' s.requirements << 'none' - s.add_dependency 'spree_core', '~> 3.0.0.rc5' - s.add_dependency 'acts-as-taggable-on', '~> 3.5' + s.add_dependency 'spree_core', '~> 3.0.6.1' + s.add_dependency 'acts-as-taggable-on', '~> 3.5.0' s.add_development_dependency 'capybara', '~> 2.2.1' s.add_development_dependency 'coffee-rails', '~> 4.0.0'