lib/zen/task/db.rake in zen-0.3 vs lib/zen/task/db.rake in zen-0.4
- old
+ new
@@ -1,7 +1,7 @@
namespace :db do
- desc 'Migrates the database to the newest version'
+ desc 'Migrates the entire database'
task :migrate do
require File.expand_path('../../../zen', __FILE__)
if Zen::Package::REGISTERED.empty?
abort "No packages have been registered."
@@ -23,13 +23,11 @@
abort "The migration directory #{dir} doesn't exist."
end
table = 'migrations_package_' + pkg.name.to_s
- # Migration time
- Sequel::Migrator.run(Zen.database, dir, :table => table)
- Ramaze::Log.info("Successfully migrated \"#{pkg.name}\"")
+ Zen::Migrator.run(pkg.name, dir, table)
end
end
desc 'Deletes the entire database'
task :delete do
@@ -57,18 +55,14 @@
abort "The migration directory #{dir} doesn't exist."
end
table = 'migrations_package_' + pkg.name.to_s
- # Migration time
- Sequel::Migrator.run(Zen.database, dir, :table => table, :target => 0)
- Zen.database.drop_table(table)
-
- Ramaze::Log.info("Successfully uninstalled \"#{pkg.name}\"")
+ Zen::Migrator.run(pkg.name, dir, table, 0)
end
end
- desc 'Creates a default administrator with a random password'
+ desc 'Creates a default admin user'
task :user do
require File.expand_path('../../../zen', __FILE__)
password = (0..12).map do
letter = ('a'..'z').to_a[rand(26)]