奇怪的耙子 db:migrate 输出 [英] Odd rake db:migrate output

查看:44
本文介绍了奇怪的耙子 db:migrate 输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么 rake db:migrate 运行 Execute db:schema:dump 我的输出都搞砸了(显示 SQL).

Why does rake db:migrate run Execute db:schema:dump my output is all screwed up (showing SQL).

看起来像这样:

  ActiveRecord::SchemaMigration Load (0.5ms)  SELECT "schema_migrations".* FROM "schema_migrations"
   (3.7ms)  SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
  AND t1.relname = 'accounts'
  AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname

   (3.2ms)  SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
  AND t1.relname = 'deliveries'
  AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname

   (3.2ms)  SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
  AND t1.relname = 'posts'
  AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname

跟踪显示:

** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
** Invoke db:_dump (first_time)
** Execute db:_dump
** Invoke db:schema:dump (first_time)
** Invoke environment 
** Invoke db:load_config 
** Execute db:schema:dump

这是在将 rails 4.1.6 升级到 rails 4.2.0 之后开始的.

This started after upgrading a rails 4.1.6 to rails 4.2.0.

为什么会发生这种情况?

Why is this occurring?

推荐答案

我得到这个奇怪的神秘 SQL'ish 输出的原因是因为我的 gemfile 中有 Heroku 的 rails_12factor gem 并且没有分组到 :production.

The reason I was getting this weird cryptic SQL'ish output is because I had Heroku's rails_12factor gem in my gemfile and not grouped to :production.

解决方案是:

group :production do
  gem 'rails_12factor'
end

并运行bundle

这篇关于奇怪的耙子 db:migrate 输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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