Rails(PostgreSQL?)隐式序列/索引警告

时间:2012-08-22 01:54:02

标签: ruby-on-rails postgresql migration database-migration

  

可能重复:
  NOTICES for sequence after running migration in rails on postgresql Application

使用PostgreSQL进行开发&测试数据库(以及生产)。当我rake db:test:prepare我的 PostgreSQL theapp_test数据库时,我会为每个表获取这些消息:

NOTICE:  CREATE TABLE will create implicit sequence "events_id_seq" for serial column "events.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "events_pkey" for table "events"
NOTICE:  CREATE TABLE will create implicit sequence "users_id_seq" for serial column "users.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "users_pkey" for table "users"
...

我不会在rake db:migrate上使用theapp_development收到这些通知。而且我没有注意到它们的制作。它是什么意思,我应该努力摆脱它们?

仅供参考 - 过去当我使用MySQL(或SQLite3)进行测试时,这种情况并未发生......

2 个答案:

答案 0 :(得分:11)

您可以通过在config/database.yml中添加(或取消注释)一行来消除这些消息:

# config/database.yml
development:
  adapter: postgresql
  min_messages: WARNING  # this line silences those NOTICE messages

答案 1 :(得分:4)

没有。这只是Postgres很棒,并且自动为你创造你真正想要的东西。这不是一个警告它只是一个FYI