Include rake migration in a plugin


#1

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


#2

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.


#3

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?