# Migration Problem

**URL:** <https://www.ruby-forum.com/t/migration-problem/134663>\
**Category:** Rails\
**Created:** [April 13, 2008, 5:21pm UTC](https://www.ruby-forum.com/t/migration-problem/134663 "2008-04-13T17:21:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prateek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ee7513/32.png) [@Prateek](https://www.ruby-forum.com/u/Prateek)\
**Post date:** [April 13, 2008, 5:21pm UTC](https://www.ruby-forum.com/t/migration-problem/134663/1 "2008-04-13T17:21:32Z")

</div>

Hello,

I am trying to change the default value of a couple of fields in a  
table. In one of my migrations, I had given a default value. It looked  
something like this (Please note - ‘users’ table already exists) -

## ================================================== [002\_add\_user\_profile.rb] [http://pastie.org/179981](http://pastie.org/179981)

class AddUserProfile \< ActiveRecord::Migration  
def self.up  
add\_column :users, :age, :integer  
add\_column :users, :qualification, :text, :default =\> “_No  
Qualifications_”  
add\_column :users, :subject, :string, :default =\> “_No Subject\</  
i\>”  
add\_column :users, :about\_me, :text, :default =\> “No About Me\</  
i\>”  
end_

 

def self.down  
remove\_column :users, :age  
remove\_column :users, :qualification  
remove\_column :users, :subject  
remove\_column :users, :about\_me  
end  
end

==================================================

So, to remove the default, I just removed the “:default” from lines  
4,5,6, and then I ran ‘rake db:migrate’. But the default it still  
there. What should I do to remove it?

Thanks,  
Prateek

---

<div class="post-metadata">

**Author:** ![Prateek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ee7513/32.png) [@Prateek](https://www.ruby-forum.com/u/Prateek)\
**Post date:** [April 13, 2008, 5:29pm UTC](https://www.ruby-forum.com/t/migration-problem/134663/2 "2008-04-13T17:29:12Z")

</div>

On 13 Apr 2008, at 16:20, Prateek wrote:

> 4,5,6, and then I ran ‘rake db:migrate’. But the default it still  
> there. What should I do to remove it?

You need to migrate down and then back up again with rake db:migrate  
VERSION=x  
(rails won’t run migration 2 if migration 2 has already been run, even  
if you’ve changed the file since).

Fred

---

<div class="post-metadata">

**Author:** ![Prateek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ee7513/32.png) [@Prateek](https://www.ruby-forum.com/u/Prateek)\
**Post date:** [April 13, 2008, 5:43pm UTC](https://www.ruby-forum.com/t/migration-problem/134663/3 "2008-04-13T17:43:21Z")

</div>

Works!  
Thanks a lot Fred.
