DEV Community

Discussion on: Create table in Rails only if it does not exist already

andrewbrown profile image
Andrew Brown πŸ‡¨πŸ‡¦

You can also force a table to be dropped and then created.
A bit more destructive but works well.

create_table :repo_subscriptions, force: true do |t|
Enter fullscreen mode Exit fullscreen mode
prathamesh profile image
Prathamesh Sonpatki Author

Yup it’s useful for tests but a bit destructive for production πŸ˜„

arnabsen1729 profile image
Arnab Sen

I was actually looking for this. Thanks