Do Not Add Database Index If It Already Exists in Railsby@prathamesh

Do Not Add Database Index If It Already Exists in Rails

tldt arrow
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

An option that will not create the table if it already exists has been added to the create_table method in Ruby on Rails 6.0.2 and below. The option is handy when we have added a table directly in production but now want to add it through a migration so that it is available in other environments as well. If this migration is run twice, it results into following error related to creating the table. The error was raised for existing index. But we do know that the index may exist. That's why we added the option to create the index.

Company Mentioned

Mention Thumbnail
featured image - Do Not Add Database Index If It Already Exists in Rails
Prathamesh HackerNoon profile picture

@prathamesh

Prathamesh

Receive Stories from @prathamesh

react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!