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



159
160
161
# File 'lib/rails/generators/database.rb', line 159

def base_package
  "postgresql-client"
end

#build_packageObject



163
164
165
# File 'lib/rails/generators/database.rb', line 163

def build_package
  "libpq-dev"
end

#feature_nameObject



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

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

#gemObject



155
156
157
# File 'lib/rails/generators/database.rb', line 155

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

#nameObject



134
135
136
# File 'lib/rails/generators/database.rb', line 134

def name
  "postgres"
end

#portObject



151
152
153
# File 'lib/rails/generators/database.rb', line 151

def port
  5432
end

#serviceObject



138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/rails/generators/database.rb', line 138

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