在postgresql应用程序的rails中运行迁移之后的序列NOTICES
当我运行在Rails应用程序postgresql我的迁移我有以下通知
NOTICE: CREATE TABLE will create implicit sequence "notification_settings_id_seq" for serial column "notification_settings.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "notification_settings_pkey" for table "notification_settings" 我的迁移文件包含088_create_notification_settings.rb
 class CreateNotificationSettings < ActiveRecord::Migration def self.up create_table :notification_settings do |t| t.integer :user_id t.integer :notification_id t.boolean :notification_on t.boolean :outbound end end def self.down drop_table :notification_settings end end 
我想知道
这个NOTICES是什么意思?
如何避免这个通知?
如果不避免,这种通知对申请的影响是什么?
问候,
萨里尔
  Rails(ActiveRecord更准确)是添加一个id列到你的表中,并使这个列成为主键。 对于PostgreSQL,这个列将有typesserial 。  serial列本质上是一个四字节整数,并与一个序列自动提供自动递增值。 
第一个通知:
注意:CREATE TABLE将为串行列“notification_settings.id”创build隐式序列“notification_settings_id_seq”
 只是告诉你,PostgreSQL正在幕后创build序列来创buildserial列function。 
第二个通知:
注意:CREATE TABLE / PRIMARY KEY将为表“notification_settings”创build隐式索引“notification_settings_pkey”
只是告诉你,PostgreSQL正在创build一个索引来帮助实现主键,即使你没有明确地要求它。
 你可以忽略这些通知,他们只是信息。 如果你想压制它们,你可以添加min_messages: WARNING到你的database.yml的相应部分。 
除了什么亩说:
如果您不想看到这些通知,可以通过将client_min_messages设置为警告(或错误)来closures它们。
 这可以在会话级别上完成,使用set client_min_messages = warning或在服务器的configuration文件中为所有连接完成: 
NOTICES与创build序列以及Postgresql在id列上创build自动增量的方式有关。
要回答其他问题:
如何避免NOTICES
在database.yml文件中只需包含min_messages:warning #magic sauce
NOTICES被忽略会对应用程序产生什么影响?
基本上它会增加日志logging,特别是如果在开发模式下运行。
有关更多详细信息,请参阅http://www.ruby-forum.com/topic/468070