Skip to content

Instantly share code, notes, and snippets.

@rmros
Forked from yshmarov/database.yml
Created January 4, 2018 20:10
Show Gist options
  • Select an option

  • Save rmros/3e907a3fef3ff05ea92c7aec9c164855 to your computer and use it in GitHub Desktop.

Select an option

Save rmros/3e907a3fef3ff05ea92c7aec9c164855 to your computer and use it in GitHub Desktop.

Revisions

  1. @yshmarov yshmarov revised this gist Jan 4, 2018. 1 changed file with 19 additions and 0 deletions.
    19 changes: 19 additions & 0 deletions database.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    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
  2. @yshmarov yshmarov created this gist Jan 4, 2018.
    18 changes: 18 additions & 0 deletions pg setup
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    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