# Include rake migration in a plugin

**URL:** <https://www.ruby-forum.com/t/include-rake-migration-in-a-plugin/151442>\
**Category:** Rails\
**Created:** [October 21, 2008, 2:57pm UTC](https://www.ruby-forum.com/t/include-rake-migration-in-a-plugin/151442 "2008-10-21T14:57:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alain\_mSL](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f0a364/32.png) [@Alain\_mSL](https://www.ruby-forum.com/u/Alain_mSL)\
**Post date:** [October 21, 2008, 2:57pm UTC](https://www.ruby-forum.com/t/include-rake-migration-in-a-plugin/151442/1 "2008-10-21T14:57:35Z")

</div>

Hi there,

as sad as it seems, I can’t find a hint on how to include a simple  
statement like  
rake db:sessions:create  
rake db:migrate  
in the rakefile of a plugin that I want to write myself.

Any help of of course appreciated - thanks in advance.

Best,  
Alain M. Lafon

---

<div class="post-metadata">

**Author:** ![Alain\_mSL](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f0a364/32.png) [@Alain\_mSL](https://www.ruby-forum.com/u/Alain_mSL)\
**Post date:** [October 21, 2008, 2:59pm UTC](https://www.ruby-forum.com/t/include-rake-migration-in-a-plugin/151442/2 "2008-10-21T14:59:20Z")

</div>

Alain m. Lafon wrote:

> as sad as it seems, I can’t find a hint on how to include a simple  
> statement like  
> rake db:sessions:create  
> rake db:migrate  
> in the rakefile of a plugin that I want to write myself.

You can invoke rake tasks with Rake::Task[‘task:name’].invoke.

---

<div class="post-metadata">

**Author:** ![Alain\_mSL](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f0a364/32.png) [@Alain\_mSL](https://www.ruby-forum.com/u/Alain_mSL)\
**Post date:** [October 21, 2008, 4:27pm UTC](https://www.ruby-forum.com/t/include-rake-migration-in-a-plugin/151442/3 "2008-10-21T16:27:19Z")

</div>

August L. wrote:

> Alain m. Lafon wrote:
> 
> > as sad as it seems, I can’t find a hint on how to include a simple  
> > statement like  
> > rake db:sessions:create  
> > rake db:migrate  
> > in the rakefile of a plugin that I want to write myself.
> 
> You can invoke rake tasks with Rake::Task[‘task:name’].invoke.

Thank you very much, this works nicely - now I have the option to call  
my own rake task.  
But is it possible to include this task in say the generator of the  
plugin so that it may be called on installation of the plugin?
