Postgresql postgres中的默认值/修饰符?
我对postgres 8.4的默认修饰符有问题。(我认为版本并不重要) 我有debian ubuntu。在rails AR上创建迁移时:Postgresql postgres中的默认值/修饰符?,postgresql,character,modifier,varying,Postgresql,Character,Modifier,Varying,我对postgres 8.4的默认修饰符有问题。(我认为版本并不重要) 我有debian ubuntu。在rails AR上创建迁移时: class CreateUserMails < ActiveRecord::Migration def self.up create_table :user_mails do |t| t.string :title, :limit=> 128, :default=> '' t.string :pla
class CreateUserMails < ActiveRecord::Migration
def self.up
create_table :user_mails do |t|
t.string :title, :limit=> 128, :default=> ''
t.string :place, :limit=> 32, :default=> ''
t.text :message
t.timestamps
end
end
def self.down
drop_table :user_mails
end
end
控制台上没有默认值
um=UserMail.new
=>#用户邮件id:nil,标题:“'':“字符变化”,位置:
“'':字符变化”,消息:nil,创建时间:nil,更新时间:nil
有人知道我如何删除这些修饰符,只保留“”或任何默认值而不改变:::字符吗?没有办法做到这一点。除了美学之外,还不清楚你为什么要这么做
Column | Type | Modifiers
--------------+-----------------------------+---------------------------------------------------------
id | integer | not null default nextval('user_mails_id_seq'::regclass)
title | character varying(128) | default ''::character varying
place | character varying(32) | default ''::character varying
message | text |
created_at | timestamp without time zone |
updated_at | timestamp without time zone |