gpt4 book ai didi

ruby - 数据库 :migrate hangs on simple migration

转载 作者:数据小太阳 更新时间:2023-10-29 06:56:07 29 4
gpt4 key购买 nike

我正在使用 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})

然后代码就卡在了这里。有什么想法吗?

来自:开发日志

[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

最佳答案

我刚刚遇到了类似的问题,一个非常简单的迁移没有明显的原因就停止了。我认为问题与无法获得数据库连接有关。我退出了在另一个终端中打开的 Rails 控制台 session ,然后迁移立即顺利完成。

关于ruby - 数据库 :migrate hangs on simple migration,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8984773/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com