Class: Rails::Generators::Database::MySQL

Inherits:
Rails::Generators::Database show all
Includes:
MySqlSocket
Defined in:
lib/rails/generators/database.rb

Constant Summary

Constants inherited from Rails::Generators::Database

DATABASES

Instance Method Summary collapse

Methods included from MySqlSocket

#host, #socket

Methods inherited from Rails::Generators::Database

all, build, #feature, #host, #socket, #volume

Instance Method Details

#base_packageObject



120
121
122
# File 'lib/rails/generators/database.rb', line 120

def base_package
  "default-mysql-client"
end

#build_packageObject



124
125
126
# File 'lib/rails/generators/database.rb', line 124

def build_package
  "default-libmysqlclient-dev"
end

#feature_nameObject



128
129
130
# File 'lib/rails/generators/database.rb', line 128

def feature_name
  "ghcr.io/rails/devcontainer/features/mysql-client"
end

#gemObject



116
117
118
# File 'lib/rails/generators/database.rb', line 116

def gem
  ["mysql2", ["~> 0.5"]]
end

#nameObject



95
96
97
# File 'lib/rails/generators/database.rb', line 95

def name
  "mysql"
end

#portObject



112
113
114
# File 'lib/rails/generators/database.rb', line 112

def port
  3306
end

#serviceObject



99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/rails/generators/database.rb', line 99

def service
  {
    "image" => "mysql/mysql-server:8.0",
    "restart" => "unless-stopped",
    "environment" => {
      "MYSQL_ALLOW_EMPTY_PASSWORD" => "true",
      "MYSQL_ROOT_HOST" => "%"
    },
    "volumes" => ["mysql-data:/var/lib/mysql"],
    "networks" => ["default"],
  }
end