简体   繁体   English

如何运行schema.rb?

[英]how to run schema.rb?

I'm trying to run db:migrate. 我正在尝试运行db:migrate。 This fails however because one of the tables that one of the migrations is trying to update does not exist. 但是,由于其中一个迁移尝试更新的表之一不存在,因此失败。 I searched the codebase and this table is created in db/schema.rb. 我搜索了代码库,这个表是在db / schema.rb中创建的。

How can I run schema.rb before db:migrate?? 如何在db:migrate之前运行schema.rb?

Use the schema load task: 使用架构加载任务:

rake db:schema:load

From rake -T (expurgated version): rake -T (删除版本):

rake db:schema:dump  # Create db/schema.rb file usable with any AR-supported DB
rake db:schema:load  # Load schema.rb file into DB

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM