This repository has been archived by the owner on Mar 19, 2021. It is now read-only.
forked from mbleigh/acts-as-taggable-on
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mbleigh#343 from bf4/294-add-missing-indices
[mbleigh#294] Add missing unique indices
- Loading branch information
Showing
8 changed files
with
39 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
When upgrading | ||
|
||
Re-run the migrations generator | ||
|
||
rake railties:install:migrations FROM=acts_as_taggable_on_engine db:migrate | ||
|
||
It will create any new migrations and skip existing ones |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
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: 'tagging_idx' | ||
add_index :taggings, :tag_id | ||
add_index :taggings, [:taggable_id, :taggable_type, :context] | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require 'rails/engine' | ||
module ActsAsTaggableOn | ||
class Engine < Rails::Engine | ||
|
||
end | ||
end |
39 changes: 0 additions & 39 deletions
39
lib/generators/acts_as_taggable_on/migration/migration_generator.rb
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
spec/generators/acts_as_taggable_on/migration/migration_generator_spec.rb
This file was deleted.
Oops, something went wrong.