Upgrade to rails 6 💎 (#11)

- upgraded to rails 6
- fixes various issues
This commit is contained in:
Sojan Jose
2019-08-19 01:19:57 -07:00
committed by Pranav Raj S
parent 3c32103e34
commit 52194116b3
53 changed files with 819 additions and 605 deletions

View File

@@ -1,5 +1,5 @@
# This migration comes from acts_as_taggable_on_engine (originally 1)
class ActsAsTaggableOnMigration < ActiveRecord::Migration
class ActsAsTaggableOnMigration < ActiveRecord::Migration[5.0]
def self.up
create_table :tags do |t|
t.string :name
@@ -20,7 +20,6 @@ class ActsAsTaggableOnMigration < ActiveRecord::Migration
t.datetime :created_at
end
add_index :taggings, :tag_id
add_index :taggings, [:taggable_id, :taggable_type, :context]
end

View File

@@ -1,5 +1,5 @@
# This migration comes from acts_as_taggable_on_engine (originally 2)
class AddMissingUniqueIndices < ActiveRecord::Migration
class AddMissingUniqueIndices < ActiveRecord::Migration[5.0]
def self.up
add_index :tags, :name, unique: true

View File

@@ -1,5 +1,5 @@
# This migration comes from acts_as_taggable_on_engine (originally 3)
class AddTaggingsCounterCacheToTags < ActiveRecord::Migration
class AddTaggingsCounterCacheToTags < ActiveRecord::Migration[5.0]
def self.up
add_column :tags, :taggings_count, :integer, default: 0

View File

@@ -1,5 +1,5 @@
# This migration comes from acts_as_taggable_on_engine (originally 4)
class AddMissingTaggableIndex < ActiveRecord::Migration
class AddMissingTaggableIndex < ActiveRecord::Migration[5.0]
def self.up
add_index :taggings, [:taggable_id, :taggable_type, :context]
end

View File

@@ -1,7 +1,7 @@
# This migration comes from acts_as_taggable_on_engine (originally 5)
# This migration is added to circumvent issue #623 and have special characters
# work properly
class ChangeCollationForTagNames < ActiveRecord::Migration
class ChangeCollationForTagNames < ActiveRecord::Migration[5.0]
def up
if ActsAsTaggableOn::Utils.using_mysql?
execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;")

View File

@@ -1,5 +1,5 @@
# This migration comes from acts_as_taggable_on_engine (originally 6)
class AddMissingIndexes < ActiveRecord::Migration
class AddMissingIndexes < ActiveRecord::Migration[5.0]
def change
add_index :taggings, :tag_id
add_index :taggings, :taggable_id

View File

@@ -1,5 +1,5 @@
class CreateTriggerConversationsInsert < ActiveRecord::Migration
class CreateTriggerConversationsInsert < ActiveRecord::Migration[5.0]
def up
change_column :conversations, :display_id, :integer, :null => false
end

View File

@@ -0,0 +1,23 @@
# This migration comes from acts_as_taggable_on_engine (originally 6)
if ActiveRecord.gem_version >= Gem::Version.new('5.0')
class AddMissingIndexesOnTaggings < ActiveRecord::Migration[4.2]; end
else
class AddMissingIndexesOnTaggings < ActiveRecord::Migration; end
end
AddMissingIndexesOnTaggings.class_eval do
def change
add_index ActsAsTaggableOn.taggings_table, :tag_id unless index_exists? ActsAsTaggableOn.taggings_table, :tag_id
add_index ActsAsTaggableOn.taggings_table, :taggable_id unless index_exists? ActsAsTaggableOn.taggings_table, :taggable_id
add_index ActsAsTaggableOn.taggings_table, :taggable_type unless index_exists? ActsAsTaggableOn.taggings_table, :taggable_type
add_index ActsAsTaggableOn.taggings_table, :tagger_id unless index_exists? ActsAsTaggableOn.taggings_table, :tagger_id
add_index ActsAsTaggableOn.taggings_table, :context unless index_exists? ActsAsTaggableOn.taggings_table, :context
unless index_exists? ActsAsTaggableOn.taggings_table, [:tagger_id, :tagger_type]
add_index ActsAsTaggableOn.taggings_table, [:tagger_id, :tagger_type]
end
unless index_exists? ActsAsTaggableOn.taggings_table, [:taggable_id, :taggable_type, :tagger_id, :context], name: 'taggings_idy'
add_index ActsAsTaggableOn.taggings_table, [:taggable_id, :taggable_type, :tagger_id, :context], name: 'taggings_idy'
end
end
end

View File

@@ -0,0 +1,8 @@
class CreateChannels < ActiveRecord::Migration[6.1]
def change
create_table :channels do |t|
t.string :name
t.timestamps
end
end
end