ruby – db:migrate在简单迁移时挂起

前端之家收集整理的这篇文章主要介绍了ruby – db:migrate在简单迁移时挂起前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用Postgresql,Rails 3.1.3和 Ruby 1.9.3.我正在努力使用db:migrate,如 here所述.

这就是我在终端中看到的:

funkdified@funkdified-laptop:~/railsprojects/hartl$bundle exec rake db:migrate --trace 
** Invoke db:migrate (first_time) 
** Invoke environment (first_time) 
** Execute environment 
** Invoke db:load_config (first_time) 
** Invoke rails_env (first_time) 
** Execute rails_env 
** Execute db:load_config 
** Execute db:migrate 
== AddEmailUniquenessIndex: migrating ======================================== 
-- add_index(:users,:email,{:unique=>true})

然后代码挂起.有什么想法吗?

来自:development.log

[1m[36m (0.1ms)[0m [1mSHOW search_path[0m 
[1m[35m (0.5ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
Migrating to CreateUsers (20120124022843) 
Migrating to AddEmailUniquenessIndex (20120124093922) 
[1m[36m (0.1ms)[0m [1mBEGIN[0m 
[1m[35m (3.6ms)[0m SELECT distinct i.relname,d.indisunique,d.indkey,t.oid 
FROM pg_class t 
INNER JOIN pg_index d ON t.oid = d.indrelid 
INNER JOIN pg_class i ON d.indexrelid = i.oid 
WHERE i.relkind = 'i' 
AND d.indisprimary = 'f' 
AND t.relname = 'users' 
AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname = ANY (current_schemas(false)) ) 
ORDER BY i.relname

解决方法

我有同样的问题..我发现有空闲的事务阻止了对这个表的进一步查询..

跑:

heroku pg:ps --app=...

查看数据库进程.你将不得不杀死空闲进程:

heroku pg:kill 913 --force --app=...

(913是空闲进程的ID – >根据您的需要更改)

猜你在找的Ruby相关文章