Reputation: 530
is there a way to do this add_index :issue_types, [:name], :unique => true
if only there is no uniqueness true?
like add_index :column, [:name], :unique => true if !:unique
I have 100s of tables where i need to find where there is no uniqueness and make it unique.
Upvotes: 0
Views: 450
Reputation: 3633
You can always check your schema.rb file.
When you see something like this:
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
You are sure that column in this case 'email' is already unique. So you can target other columns for migrations.
Upvotes: 1