問題:
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