Class: Stable::Services::Database::MySQL

Inherits:
Base
  • Object
show all
Defined in:
lib/stable/services/database/mysql.rb

Overview

MySQL database management service

Instance Method Summary collapse

Methods inherited from Base

#initialize, #prepare

Constructor Details

This class inherits a constructor from Stable::Services::Database::Base

Instance Method Details

#create_database(creds) ⇒ Object



15
16
17
18
19
# File 'lib/stable/services/database/mysql.rb', line 15

def create_database(creds)
  System::Shell.run(
    "mysql -u #{creds[:user]} -p#{creds[:password]} -e 'CREATE DATABASE IF NOT EXISTS #{@database_name};'"
  )
end

#setupObject



8
9
10
11
12
13
# File 'lib/stable/services/database/mysql.rb', line 8

def setup
  creds = Stable::Utils::Prompts.mysql_root_credentials
  create_database(creds)
  write_database_yml(creds)
  prepare
end