You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rails >= 3.0.3 aborts migrations if they try to create an index with a name are longer than 64 characters on PostgreSQL or MySQL (yes, 64, not 63 like the error says).
When acts_as_versioned creates indexes, it does not check the length of the resulting index name.
The patch below fixes that. It fixes the problem on MySQL and PostgreSQL (I tested both).
--- acts_as_versioned.rb 2011-05-06 11:37:30.000000000 -0400
+++ acts_as_versioned.rb 2011-05-06 11:29:47.000000000 -0400
@@ -440,7 +440,9 @@
:precision => type_col.precision
end
- self.connection.add_index versioned_table_name, versioned_foreign_key
+ # Make sure not to create an index that is too long (postgres limits index names to 64 characters)
+ name = 'index_' + versioned_table_name + '_on_' + versioned_foreign_key
+ self.connection.add_index versioned_table_name, versioned_foreign_key, :name => name[0,63]
end
# Rake migration task to drop the versioned table
The text was updated successfully, but these errors were encountered:
cure
added a commit
to cure/acts_as_versioned
that referenced
this issue
Jun 19, 2011
…ersioned:
technoweenie#4technoweenie#4
MySQL decimal Datatype Requires Migration With ":precision => ..."
to Avoid "No integer type has byte size " Error
technoweenie#9technoweenie#9
MySQL/PosgreSQL: Index name on table is too long; the limit is 63 characters
mjsommer
pushed a commit
to mjsommer/acts_as_versioned
that referenced
this issue
Apr 18, 2014
Rails >= 3.0.3 aborts migrations if they try to create an index with a name are longer than 64 characters on PostgreSQL or MySQL (yes, 64, not 63 like the error says).
When acts_as_versioned creates indexes, it does not check the length of the resulting index name.
The patch below fixes that. It fixes the problem on MySQL and PostgreSQL (I tested both).
The text was updated successfully, but these errors were encountered: