Sha256: 920293c8099ed79edce2fdb9ebc5a200536cc5a74f225c7be871c002a49694d4
Contents?: true
Size: 1.68 KB
Versions: 2
Compression:
Stored size: 1.68 KB
Contents
# ------------------------------------ # --- RUBYNETTI DUMP POWER ----------- # ------------------------------------ # Queste azioni rake permettono di importare il db da linea di comando. # Esempi di uso: # - rake db:import_from_staging # - rake db:import_from_sql (importa sql da dumps/db-staging.sql) namespace :db do desc 'Dump db from staging and copy inside locale' # esempio: rake db:import_from_staging task import_from_staging: :environment do Rake::Task['db:dump_and_download'].invoke Rake::Task['db:substitute'].invoke(AmicoDb.configuration.folder_dump) end # esempio: rake db:import_from_sql desc 'Dump db di staging' task import_from_sql: :environment do Rake::Task['db:substitute'].invoke(AmicoDb.configuration.folder_dump) end desc 'Dump database and import requested dump' task :substitute, [:dump_path] => :environment do |_task, args| Rake::Task['db:drop'].invoke Rake::Task['db:create'].invoke Rake::Task['db:environment:set'].invoke Rake::Task['db:import'].invoke("#{args.dump_path.sub('/','')}") end desc 'Download from staging sql dump of db' task download: :environment do AmicoDb::Download.new.call end desc 'Import requested dump' task :import, [:dump_path] => :environment do |_task, args| db_name = AmicoDb.configuration.db_dev_dbname user = AmicoDb.configuration.db_dev_username system("pv #{args.dump_path} | mysql -h db -u #{user} -p #{db_name}") end desc 'Dump and download from staging db' task dump_and_download: :environment do Rake::Task['db:dump'].invoke Rake::Task['db:download'].invoke end desc 'Dump db staging' task dump: :environment do AmicoDb::Dump.new.call end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
amico-db-0.1.8 | lib/tasks/db.rake |
amico-db-0.1.7 | lib/tasks/db.rake |