Class: Rails::Generators::Database::PostgreSQL

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

Constant Summary

Constants inherited from Rails::Generators::Database

DATABASES

Instance Method Summary collapse

Methods inherited from Rails::Generators::Database

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

Instance Method Details

#base_packageObject



196
197
198
# File 'lib/rails/generators/database.rb', line 196

def base_package
  "postgresql-client"
end

#build_packageObject



200
201
202
# File 'lib/rails/generators/database.rb', line 200

def build_package
  "libpq-dev"
end

#feature_nameObject



204
205
206
# File 'lib/rails/generators/database.rb', line 204

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

#gemObject



192
193
194
# File 'lib/rails/generators/database.rb', line 192

def gem
  ["pg", ["~> 1.1"]]
end

#nameObject



167
168
169
# File 'lib/rails/generators/database.rb', line 167

def name
  "postgres"
end

#portObject



188
189
190
# File 'lib/rails/generators/database.rb', line 188

def port
  5432
end

#serviceObject



175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/rails/generators/database.rb', line 175

def service
  {
    "image" => "postgres:16.1",
    "restart" => "unless-stopped",
    "networks" => ["default"],
    "volumes" => ["postgres-data:/var/lib/postgresql/data"],
    "environment" => {
      "POSTGRES_USER" => "postgres",
      "POSTGRES_PASSWORD" => "postgres"
    }
  }
end

#templateObject



171
172
173
# File 'lib/rails/generators/database.rb', line 171

def template
  "config/databases/postgresql.yml"
end