mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-04 00:08:50 +01:00
Workaround a problem with SQLite 3 and long index names
Index names can only be a certain length. The remove_user_from_taggings migration, when run on sqlite3, creates an index name that violates the maximum length check. Fix it by removing and then recreating the indexes as part of the migration.
This commit is contained in:
parent
fc69c6cfbf
commit
a97384f318
1 changed files with 10 additions and 1 deletions
|
|
@ -1,9 +1,18 @@
|
|||
class RemoveUserFromTaggings < ActiveRecord::Migration
|
||||
def self.up
|
||||
remove_index :taggings, [:tag_id, :taggable_id, :taggable_type]
|
||||
remove_index :tags, :name
|
||||
remove_column :taggings, :user_id
|
||||
add_index :tags, :name
|
||||
add_index :taggings, [:tag_id, :taggable_id, :taggable_type]
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :taggings, [:tag_id, :taggable_id, :taggable_type]
|
||||
remove_index :tags, :name
|
||||
add_column :taggings, :user_id, :integer
|
||||
add_index :tags, :name
|
||||
add_index :taggings, [:tag_id, :taggable_id, :taggable_type]
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue