如何运行schema.rb? [英] how to run schema.rb?

查看:59
本文介绍了如何运行schema.rb?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行 db:migrate.但是,这失败了,因为其中一个迁移尝试更新的表之一不存在.我搜索了代码库,这个表是在 db/schema.rb 中创建的.

I'm trying to run 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:migrate 之前运行 schema.rb??

How can I run schema.rb before db:migrate??

推荐答案

使用架构加载任务:

rake db:schema:load

来自 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

这篇关于如何运行schema.rb?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆