Skip to content

Instantly share code, notes, and snippets.

View imidsac's full-sized avatar

SACKO Idriss imidsac

View GitHub Profile
@ibraheem4
ibraheem4 / postgres-brew.md
Last active July 11, 2025 10:31 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@kofronpi
kofronpi / db.rake
Last active August 28, 2017 09:32 — forked from hopsoft/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
namespace :db do
DUMP_FMT = 'p' # 'c', 'p', 't', 'd'
desc 'Dumps the database to backups'
task sql_dump: :environment do
dump_sfx = suffix_for_format(DUMP_FMT)
backup_dir = backup_directory(true)
cmd = nil
with_config do |app, host, db, user|
file_name = Time.now.strftime("%Y%m%d%H%M%S") + "_" + db + '.' + dump_sfx
@hopsoft
hopsoft / db.rake
Last active July 4, 2025 14:22
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd