Module: SwitchDb::Database::Mysql

Extended by:
Abstract
Defined in:
lib/switch_db/database/mysql.rb

Class Method Summary collapse

Methods included from Abstract

create_database, drop_database, dump_database, import_database

Class Method Details

.create_database(database_name) ⇒ Object



11
12
13
# File 'lib/switch_db/database/mysql.rb', line 11

def create_database(database_name)
  `mysql #{user_and_password} --execute="CREATE DATABASE #{database_name}"`
end

.drop_database(database_name) ⇒ Object



7
8
9
# File 'lib/switch_db/database/mysql.rb', line 7

def drop_database(database_name)
  `mysql #{user_and_password} --execute="DROP DATABASE #{database_name}"`
end

.dump_database(database_name, output_path) ⇒ Object



19
20
21
# File 'lib/switch_db/database/mysql.rb', line 19

def dump_database(database_name, output_path)
  `mysqldump #{user_and_password} #{database_name} > #{output_path}`
end

.import_database(database_name, database_path) ⇒ Object



15
16
17
# File 'lib/switch_db/database/mysql.rb', line 15

def import_database(database_name, database_path)
  `mysql #{user_and_password} #{database_name} < #{database_path}`
end