Class: RedmineInstaller::Database::MySQL

Inherits:
Base show all
Defined in:
lib/redmine-installer/database.rb

Constant Summary

Constants included from Utils

Utils::PROGRESSBAR_FORMAT

Instance Attribute Summary

Attributes inherited from Base

#backup

Instance Method Summary collapse

Methods inherited from Base

#backuped?, #build, #do_restore, #get_parameters, #initialize, #make_backup, #make_config, #set_paramaters, #to_s

Methods included from Utils

#class_name, #create_dir, #env_user, #error, #logger, #ok, #pastel, #print_title, #prompt, #run_command

Constructor Details

This class inherits a constructor from RedmineInstaller::Database::Base

Instance Method Details

#adapter_nameObject



128
129
130
# File 'lib/redmine-installer/database.rb', line 128

def adapter_name
  'mysql2'
end

#backup_command(file) ⇒ Object



149
150
151
# File 'lib/redmine-installer/database.rb', line 149

def backup_command(file)
  "mysqldump --add-drop-database --compact --result-file=#{file} #{command_args} #{@database}"
end

#command_argsObject



132
133
134
135
136
137
138
139
# File 'lib/redmine-installer/database.rb', line 132

def command_args
  args = []
  args << "--host=#{@host}"         unless @host.to_s.empty?
  args << "--port=#{@port}"         unless @port.to_s.empty?
  args << "--user=#{@username}"     unless @username.to_s.empty?
  args << "--password=#{@password}" unless @password.to_s.empty?
  args.join(' ')
end

#create_database_commandObject



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

def create_database_command
  "mysql #{command_args} --execute=\"create database #{@database}\""
end

#default_portObject



124
125
126
# File 'lib/redmine-installer/database.rb', line 124

def default_port
  3306
end

#drop_database_commandObject



145
146
147
# File 'lib/redmine-installer/database.rb', line 145

def drop_database_command
  "mysql #{command_args} --execute=\"drop database #{@database}\""
end

#restore_command(file) ⇒ Object



153
154
155
# File 'lib/redmine-installer/database.rb', line 153

def restore_command(file)
  "mysql #{command_args} #{@database} < #{file}"
end