Skip to content

Instantly share code, notes, and snippets.

@yshmarov
Last active November 11, 2020 19:46
Show Gist options
  • Save yshmarov/7587ba3d3c3cdafc900fe065fa1c6a21 to your computer and use it in GitHub Desktop.
Save yshmarov/7587ba3d3c3cdafc900fe065fa1c6a21 to your computer and use it in GitHub Desktop.
commands for activating pg (postgresql) for rails on c9.io platform
default: &default
adapter: postgresql
encoding: unicode
pool: 5
username: yaro
password: pass
host: <%= ENV['IP'] %>
development:
<<: *default
database: myclass110_development
test:
<<: *default
database: myclass110_test
production:
<<: *default
database: myclass110_production
sudo service postgresql start
sudo sudo -u postgres psql
CREATE USER yaro SUPERUSER PASSWORD 'pass';
\q
echo "export USERNAME=yaro"
echo "export PASSWORD=pass"
source
bundle
sudo sudo -u postgres psql
UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';
DROP DATABASE template1;
CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE';
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';
\c template1
VACUUM FREEZE;
\q
bundle exec rake db:create
rake db:migrate
@yshmarov
Copy link
Author

sudo service postgresql start
sudo sudo -u postgres psql
CREATE USER yaro SUPERUSER PASSWORD 'pass';
\q
echo "export USERNAME=yaro"
echo "export PASSWORD=pass"
source
bundle
sudo sudo -u postgres psql
UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';
DROP DATABASE template1;
CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE';
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';
\c template1
VACUUM FREEZE;
\q
bundle exec rake db:create
rake db:migrate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment