Right now, the current migration might fail, if the books table doesn\'t have created_at or updated_at fields:
books
created_at
updated_at
class AddTi
There is also index_name_exists?(table_name, index_name) method which let's you check for an index by it's name. It's helpful for checking for existence of multi-column indexes.
index_name_exists?(table_name, index_name)
Documentation - index_name_exists