I know that i can touch a migration and add
add_index :table_name, :column_name, :unique => true
But how is the right rails migration command to generate this?
rails g migration add_index_to_column_name :column_name, :unique => true
Is that right?
In my special example I have a table customers
t.integer :customerID
t.string :surname
t.string :first_name
t.string :phone
an i want to set the customerID to unique. Tried
rails g migration AddIndexToCustomers :customerID, :unique => true
But if i look to my migration file after this, it dont look right see this:
def change
add_column :customers, :, :customerID,
add_column :customers, :, :unique
add_column :customers, :=, :string
end
Any idea or suggestion?