Skip to content

Migrate sqlite to postgres

NatTuck edited this page Sep 23, 2013 · 4 revisions

Before pulling the git patch:

# Important! Save the data.
RAILS_ENV=production rake db:data:dump

# Install and set up postgres server
sudo apt-get install postgresql postgresql-client libpq-dev pwgen
sudo su - postgres
createuser -dRS rsense
createdb -Eutf8 -Orsense rsense_production

Then

# Pull the branch
chmod a-x .git/hooks/post-merge
git pull whatever
chmod a+x .git/hooks/post-merge
bundle install

After pulling the patch

# Create the postgres production database
RAILS_ENV=production rake db:create db:schema:load
RAILS_ENV=production rake db:data:load
touch tmp/restart.txt