Sha256: cae4c796b315abca34bf503441613ec819a872b9e7a49be38a14ab6b14e35acc
Contents?: true
Size: 902 Bytes
Versions: 9
Compression:
Stored size: 902 Bytes
Contents
# coding: UTF-8 require 'rake' namespace :dad do namespace :db do task :create do config = YAML.load_file("#{Rails.root}/config/database.yml") system("mkdir -p tmp") system("echo '# mysql ddl' > tmp/create_databases.sql") config.each do |env, props| puts "database for environment #{env}" system("echo 'drop database if exists #{props['database']};' >> tmp/create_databases.sql") system("echo 'create database #{props['database']};' >> tmp/create_databases.sql") system("echo 'grant all on #{props['database']}.* to #{props['username']} identified by \"#{props['password']}\";' >> tmp/create_databases.sql") end system("echo >> tmp/create_databases.sql") system("cat tmp/create_databases.sql") ret = system("mysql -u root -p < tmp/create_databases.sql") fail unless ret end end end
Version data entries
9 entries across 9 versions & 1 rubygems