如果 schema.rb 不存在,为什么 Cucumber 会删除表?

Why does Cucumber drop tables if schema.rb is not present?

我有一个 Rails 4 应用程序,它使用我无法控制的外部数据库。所以没有架构或迁移。无论如何,我创建了一个模型并使用 db 在模型中设置 table_name。

当我 运行 黄瓜时,它会删除数据库表!? 知道为什么以及如何避免它吗?

$ bundle exec cucumber

Running via Spring preloader in process 18865

.../db/schema.rb doesn't exist yet. Run `rake 
db:migrate` to create it, then try again. If you do not intend to use a 
database, you should instead alter 
.../config/application.rb to limit the frameworks that 
will be loaded.

之后数据库为空,没有表。

如果 ActiveRecord 正在连接到数据库,您应该仍然能够在本地转储您的架构。

rake db:schema:dump