檢查Rails中是否存在表 - Check if a table exists in Rails

問題:

I have a rake task that won't work unless a table exists. 我有一個rake任務,除非存在一個表,否則它將無效。 I'm working with more than 20 engineers on a website so I want to make sure they have migrated the table before they can do a rake task which will populate that respective table. 我正在一個網站上與20多名工程師一起工作,所以我想確保他們已經遷移了表,然後才能執行一個rake任務,該任務將填充相應的表。

Does AR have a method such as Table.exists ? AR有一個像Table.exists這樣的方法嗎? How can I make sure they have migrated the table successfully? 如何確保他們已成功遷移表?


解決方案:

參考一: https://en.stackoom.com/question/ReO3
參考二: https://stackoom.com/question/ReO3
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章