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

Do Not Add Database Index If It Already Exists in Rails

by Prathamesh5mMay 10th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

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

@prathamesh

Developer Evangelist at Last9

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

About Author

Prathamesh HackerNoon profile picture
Prathamesh@prathamesh
Developer Evangelist at Last9

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite
Also published here