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



可能重复:
在postgresql应用程序上的rails中运行迁移后的序列通知

使用PostgreSQL进行开发&测试数据库(以及生产)。当我rake db:test:prepare我的PostgreSQLtheapp_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"
...

我在theapp_development上没有收到rake db:migrate的这些通知。我还没有注意到它们在生产中。这意味着什么?我应该努力摆脱它们吗?

仅供参考-这在过去我使用MySQL(或SQLite3)进行测试时没有发生过。。。

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

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

否。这只是Postgres非常棒,可以自动为你创建你真正想要的东西。这不是一个警告,它只是一个仅供参考的

最新更新