Skip to content

Instantly share code, notes, and snippets.

View stretchkennedy's full-sized avatar
💭
git push -f #yolo

Tim Kennedy stretchkennedy

💭
git push -f #yolo
View GitHub Profile
@stretchkennedy
stretchkennedy / upgrade.sh
Last active November 30, 2015 00:46 — forked from patricksamson/Postgresql pg_upgrade on Ubuntu for pgsql 9.3 to 9.4
Postgresql pg_upgrade on Ubuntu Trusty for pgsql 9.3 to 9.4
# Add postgresql repo and update apt listing
echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list > /dev/null
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install postgresql-9.4 -y
# Stop all running postgresql servers -- needed for migration of 9.3 data to 9.4 (pg_upgrade execution)
sudo /etc/init.d/postgresql stop
# First configure your models to use Amazon s3 as storage option and setup the associated S3 config.
# Then add the classes your want to migrate in the klasses array below.
# Then run rake paperclip_migration:migrate_to_s3
# Should work but this is untested and may need some tweaking - but it did the job for me.
namespace :paperclip do
desc "migrate files from local filesystem to s3"
task :migrate_to_s3 => :environment do
Rails.application.eager_load!