How can I set default value for each column in a Database?

I know I can set it on add_column command but I am looking for a way to
set the default when creating the Table. See below code, how can I set
each of them a default value.

def self.up
create_table :bay_infos, :primary_key => :IP do |t|
t.string :HostName
t.string :IP
t.string :Description
t.string :user_name
t.string :password

  t.timestamps
end

end

On Nov 23, 11:11 am, Zhao Yi [email protected] wrote:

I know I can set it on add_column command but I am looking for a way to
set the default when creating the Table. See below code, how can I set
each of them a default value.

http://api.rubyonrails.com/classes/ActiveRecord/ConnectionAdapters/TableDefinition.html#M001735

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs