我正在新工作站上设置现有的 rails 应用程序。当我尝试时rake db:migrate
,在尝试创建第一个表之前,我得到了这个奇怪的错误(是的,我从 开始rake db:create
):
$ bundle exec rake db:migrate
rake aborted!
Mysql2::Error: Table 'myapp_dev.usage_roles' doesn't exist: SHOW FULL FIELDS FROM `usage_roles`
# ... followed by a long stack trace
我无法猜测为什么 rake 任务试图在任何表存在之前显示任何表中的字段。我什至没有在应用程序中看到太多提及此表。这是完整的grep:
$ grep -r usage_roles .
Binary file ./.git/index matches
./app/models/usage/role.rb: self.table_name = 'usage_roles'
./app/models/usage/user.rb: where(" usage_roles.name in (?)", Usage::Role::SUPPORT_ROLES)
./coverage/index.html: <code class="ruby"> self.table_name = 'usage_roles'</code>
./coverage/index.html: <code class="ruby"> where(" usage_roles.name in (?)", Usage::Role::SUPPORT_ROLES)</code>
./db/migrate/20130112104233_create_usage_roles.rb: execute('CREATE VIEW usage_roles AS SELECT
./db/migrate/20130112104233_create_usage_roles.rb: * FROM clu_enums.usage_roles;')
./db/migrate/20130112104233_create_usage_roles.rb: execute('DROP VIEW IF EXISTS usage_roles;')