2604fad164
[#46224565] The following rake tasks are added and work similar to how they work in rails apps: * db:create * db:drop * db:migrate * db:migrate:status * db:rollback * db:schema:dump * db:schema:load * db:seed (but no db seeds defined at this time) * db:setup * db:version The hidden task db:test:prepare is also available, which means `rake spec` can depend on it so that the test database is dropped and recreated from the development database when running specs (Although there are yet to be database tests, this branch is in preparation for that work that will be split between multiple developers.)
22 lines
853 B
Ruby
22 lines
853 B
Ruby
# Rake tasks added for compatibility with rake tasks that depend on a Rails
|
|
# environment, such as those in activerecord
|
|
|
|
# Would normally load config/environment.rb of the rails application.
|
|
#
|
|
# @see https://github.com/rails/rails/blob/e2908356672d4459ada0064f773efd820efda822/railties/lib/rails/application.rb#L190
|
|
task :environment do
|
|
# ensures that Mdm models are available for migrations which use the models
|
|
MetasploitDataModels.require_models
|
|
|
|
# avoids the need for Rails.root in db:schema:dump
|
|
schema_pathname = Metasploit::Framework.root.join('db', 'schema.rb')
|
|
ENV['SCHEMA'] = schema_pathname.to_s
|
|
end
|
|
|
|
# This would normally default RAILS_ENV to development if ENV['RAILS_ENV'] is
|
|
# not set
|
|
#
|
|
# @see https://github.com/rails/rails/blob/1a275730b290c1f06d4e8df680d22ae1b41ab585/railties/lib/rails/tasks/misc.rake#L3
|
|
task :rails_env do
|
|
end
|