Rake task for making api log schema

This commit is contained in:
Martin Lensment 2015-01-09 16:56:52 +02:00
parent d5a824064e
commit 7b920cac2f
6 changed files with 70 additions and 13 deletions

12
lib/tasks/api_log.rake Normal file
View file

@ -0,0 +1,12 @@
namespace :api_log do
namespace :schema do
# desc 'Dump additional database schema'
task :dump => [:environment] do
filename = "#{Rails.root}/db/api_log_schema.rb"
File.open(filename, 'w:utf-8') do |file|
ActiveRecord::Base.establish_connection("api_log_#{Rails.env}")
ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)
end
end
end
end