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

Z

Zhao Yi

I created a database in my rails project and want to set default value
for each column. I have read the self.up method of the file
db\migrate\20081123094926_create_bay_infos.rb and thought that this is
where I need to modify. But I don't know how to do this.
 
B

Brian Candler

Zhao said:
I created a database in my rails project and want to set default value
for each column. I have read the self.up method of the file
db\migrate\20081123094926_create_bay_infos.rb and thought that this is
where I need to modify. But I don't know how to do this.

http://ar.rubyonrails.com/

Scroll down to "migrations", click "learn more"

Search for :default to see some examples

Note that Rails questions are best asked on a Rails mailing list or
group. This list is focussed on the Ruby programming language, not Rails
(which is an application/framework written *in* Ruby)
 
Z

Zhao Yi

Brian said:
http://ar.rubyonrails.com/

Scroll down to "migrations", click "learn more"

Search for :default to see some examples

Note that Rails questions are best asked on a Rails mailing list or
group. This list is focussed on the Ruby programming language, not Rails
(which is an application/framework written *in* Ruby)

Oh sorry for posting to a wrong forum. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,039
Messages
2,570,376
Members
47,031
Latest member
AndreBucki

Latest Threads

Top