From a97384f318145b697783237746933dcff940e200 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Sat, 5 May 2012 21:46:32 -0500 Subject: [PATCH] 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. --- db/migrate/045_remove_user_from_taggings.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/db/migrate/045_remove_user_from_taggings.rb b/db/migrate/045_remove_user_from_taggings.rb index dec44876..0c23bec3 100644 --- a/db/migrate/045_remove_user_from_taggings.rb +++ b/db/migrate/045_remove_user_from_taggings.rb @@ -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 \ No newline at end of file + +end