Class: Redmine::Installer::Plugin::Database::MySQL

Inherits:
Redmine::Installer::Plugin::Database show all
Defined in:
lib/redmine-installer/plugins/database.rb

Overview

MySQL

Constant Summary

Constants inherited from Redmine::Installer::Plugin::Database

DATABASE_BACKUP_DIR, DATABASE_YML_PATH

Instance Attribute Summary

Attributes inherited from Redmine::Installer::Plugin::Database

#params

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Redmine::Installer::Plugin::Database

#backup, backup_all, #build, #file_for_backup, #get, #load, load_all, #make_config, #restore, restore_all

Methods inherited from Base

all, inherited, title

Methods included from Utils

included

Constructor Details

#initializeMySQL

Returns a new instance of MySQL.



125
126
127
128
# File 'lib/redmine-installer/plugins/database.rb', line 125

def initialize
  super
  @params.add('port').default(3306)
end

Class Method Details

.adapter_nameObject



121
122
123
# File 'lib/redmine-installer/plugins/database.rb', line 121

def self.adapter_name
  'mysql2'
end

Instance Method Details

#command_argsObject



130
131
132
# File 'lib/redmine-installer/plugins/database.rb', line 130

def command_args
  "-h #{params['host'].value} -P #{get('port')} -u #{get('username')} -p#{get('password')} #{get('database')}"
end

#command_for_backup(file) ⇒ Object



138
139
140
# File 'lib/redmine-installer/plugins/database.rb', line 138

def command_for_backup(file)
  "mysqldump --add-drop-database #{command_args} > #{file}"
end

#command_for_emptyObject



134
135
136
# File 'lib/redmine-installer/plugins/database.rb', line 134

def command_for_empty
  "mysql #{command_args} -e 'drop database #{get('database')}; create database #{get('database')};'"
end

#command_for_restore(file) ⇒ Object



142
143
144
# File 'lib/redmine-installer/plugins/database.rb', line 142

def command_for_restore(file)
  "mysql #{command_args} < #{file}"
end