Skip to content

Instantly share code, notes, and snippets.

@ryanclark2
Created July 10, 2012 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanclark2/3085444 to your computer and use it in GitHub Desktop.
Save ryanclark2/3085444 to your computer and use it in GitHub Desktop.
Migrate error
$ rake db:migrate
== CreateWarehouseTransactionStateTransitions: migrating =====================
-- create_table(:warehouse_transaction_state_transitions)
-> 0.0641s
-- add_index(:warehouse_transaction_state_transitions, :warehouse_transaction_id)
rake aborted!
An error has occurred, this and all later migrations canceled:
Index name 'index_warehouse_transaction_state_transitions_on_warehouse_transaction_id' on table 'warehouse_transaction_state_transitions' is too long; the limit is 63 characters
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
#add name to index.
add_index :warehouse_transaction_state_transitions, :warehouse_transaction_id, :name =>'audit_index'
$ rake db:migrate
== CreateWarehouseTransactionStateTransitions: migrating =====================
-- create_table(:warehouse_transaction_state_transitions)
NOTICE: CREATE TABLE will create implicit sequence "warehouse_transaction_state_transitions_id_seq" for serial column "warehouse_transaction_state_transitions.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "warehouse_transaction_state_transitions_pkey" for table "warehouse_transaction_state_transitions"
-> 0.0097s
-- add_index(:warehouse_transaction_state_transitions, :warehouse_transaction_id, {:name=>"audit_index"})
-> 0.0107s
== CreateWarehouseTransactionStateTransitions: migrated (0.0210s) ============
.
.
.
state_machine :state, :initial => :incoming do
store_audit_trail :to => 'WarehouseTransactionStateTransition'
.
.
.
class WarehouseTransactionStateTransition < ActiveRecord::Base
belongs_to :warehouse_transaction
attr_accessible :created_at, :event, :from, :to
end
@ryanclark2
Copy link
Author

Does adding a name to the index break the audit trail? Doesn't seem to be logging for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment