Sha256: 7abc79e62830b952c07d75043c54e2dbad91118deb973941c29687a6403b9a8b

Contents?: true

Size: 779 Bytes

Versions: 1

Compression:

Stored size: 779 Bytes

Contents

require 'fileutils'

namespace :dm do
  namespace :db do
    desc "Perform automigration"
    task :automigrate => :merb_env do
      DataMapper::Persistence.auto_migrate!
    end
  end
  
  namespace :sessions do
    desc "Creates session migration"
    task :create => :merb_env do
      dest = File.join(Merb.root, "schema", "migrations","001_add_sessions_table.rb")
      source = File.join(File.dirname(__FILE__), "merb", "session","001_add_sessions_table.rb")
      #FileUtils.cp source, dest unless File.exists?(dest)
    end
    
    desc "Clears sessions"
    task :clear => :merb_env do
      table_name = (Merb::Plugins.config[:datamapper][:session_table_name] || "sessions")
      #Merb::Orms::DataMapper.connect.execute("DELETE FROM #{table_name}")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
merb_datamapper-0.5 lib/merb/orms/data_mapper/tasks/databases.rb