Sha256: 72ce972942856e7e41188f297665f03c048c547009e92c278f6a0700cb0ce7bd
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
require_relative "helper.rb" require 'capistrano/container' module Capistrano module Container module DB module LoadHelper def self.import_on_local() LoadHelper.create_db_if_not_exists fetch(:db_name) run_locally do execute "mysql #{Helper::mysql_restore_args} < #{fetch(:db_local_dump)}" end end def self.import_on_container(container) container.upload!(fetch(:db_local_dump), fetch(:db_remote_dump)) LoadHelper.create_db_if_not_exists fetch(:db_name) container.execute "mysql #{Helper::mysql_restore_args} < #{fetch(:db_remote_dump)}" end def self.import_on_server() upload!(fetch(:db_local_dump), fetch(:db_remote_dump)) LoadHelper.create_db_if_not_exists fetch(:db_name) execute("mysql #{Helper::mysql_restore_args} < #{fetch(:db_remote_dump)}") end def self.create_db_if_not_exists(db) Helper.execute_db_command_autodetect "CREATE DATABASE IF NOT EXISTS #{db};" end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
capistrano-container-db-0.0.6 | lib/db/load_helper.rb |