问题:
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