# Migration problem

**URL:** <https://www.ruby-forum.com/t/migration-problem/106479>\
**Category:** Rails\
**Created:** [June 11, 2007, 4:13am UTC](https://www.ruby-forum.com/t/migration-problem/106479 "2007-06-11T04:13:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![giorgio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/cab0a1/32.png) [@giorgio](https://www.ruby-forum.com/u/giorgio)\
**Post date:** [June 11, 2007, 4:13am UTC](https://www.ruby-forum.com/t/migration-problem/106479/1 "2007-06-11T04:13:40Z")

</div>

Hi,

I seem to have a fundamental misunderstaning or Rake, Ruby, or  
Migrations.(or perhaps all three)

I have done dozens of simple Migrations with just a self.up and  
self.down… Now I have one that is more complex and I want to call  
other methods within the migration… but it doesn’t work…  
Here is my self.up:  
def self.up  
drop\_old\_tables  
create\_tables  
populate\_questions  
populate\_forms  
end

here is the error message:  
undefined method `drop\_old\_tables’ for  
#ActiveRecord::ConnectionAdapters::MysqlAdapter:0x499deb0

I have a drop\_old\_tables method defined lower down.

Thanks in anticipation for any help

Giorgio

---

<div class="post-metadata">

**Author:** ![giorgio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/cab0a1/32.png) [@giorgio](https://www.ruby-forum.com/u/giorgio)\
**Post date:** [June 11, 2007, 4:21am UTC](https://www.ruby-forum.com/t/migration-problem/106479/2 "2007-06-11T04:21:41Z")

</div>

I figured it out myself!

All the methods must be class methods as there is no instance I  
suppose.  
ie self.drop\_old\_tables etc.

Cheers  
Giorgio

---

<div class="post-metadata">

**Author:** ![giorgio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/cab0a1/32.png) [@giorgio](https://www.ruby-forum.com/u/giorgio)\
**Post date:** [June 11, 2007, 4:44am UTC](https://www.ruby-forum.com/t/migration-problem/106479/3 "2007-06-11T04:44:42Z")

</div>

Make sure the other methods are defined on the same class and as class  
methods with “def self.x”

Michael
