PostgreSQL@11: Add datadir, PG_VERSION check, and log file helpers
Also remove migration notes from caveats.master
parent
caa07807a2
commit
39b7f22269
|
@ -71,19 +71,26 @@ class PostgresqlAT11 < Formula
|
|||
return if ENV["CI"]
|
||||
|
||||
(var/"log").mkpath
|
||||
(var/name).mkpath
|
||||
unless File.exist? "#{var}/#{name}/PG_VERSION"
|
||||
system "#{bin}/initdb", "--locale=C", "-E", "UTF-8", "#{var}/#{name}"
|
||||
end
|
||||
postgresql_datadir.mkpath
|
||||
system "#{bin}/initdb", "--locale=C", "-E", "UTF-8", postgresql_datadir unless pg_version_exists?
|
||||
end
|
||||
|
||||
def postgresql_datadir
|
||||
var/name
|
||||
end
|
||||
|
||||
def postgresql_log_path
|
||||
var/"log/#{name}.log"
|
||||
end
|
||||
|
||||
def pg_version_exists?
|
||||
(postgresql_datadir/"PG_VERSION").exist?
|
||||
end
|
||||
|
||||
def caveats
|
||||
<<~EOS
|
||||
To migrate existing data from a previous major version of PostgreSQL run:
|
||||
brew postgresql-upgrade-database
|
||||
|
||||
This formula has created a default database cluster with:
|
||||
initdb --locale=C -E UTF-8 #{var}/postgres
|
||||
initdb --locale=C -E UTF-8 #{postgresql_datadir}
|
||||
For more details, read:
|
||||
https://www.postgresql.org/docs/#{version.major}/app-initdb.html
|
||||
EOS
|
||||
|
@ -105,16 +112,16 @@ class PostgresqlAT11 < Formula
|
|||
<array>
|
||||
<string>#{opt_bin}/postgres</string>
|
||||
<string>-D</string>
|
||||
<string>#{var}/#{name}</string>
|
||||
<string>#{postgresql_datadir}</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>WorkingDirectory</key>
|
||||
<string>#{HOMEBREW_PREFIX}</string>
|
||||
<key>StandardOutPath</key>
|
||||
<string>#{var}/log/#{name}.log</string>
|
||||
<string>#{postgresql_log_path}</string>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>#{var}/log/#{name}.log</string>
|
||||
<string>#{postgresql_log_path}</string>
|
||||
</dict>
|
||||
</plist>
|
||||
EOS
|
||||
|
|
Loading…
Reference in New Issue