Cloud9 postgres

后端 未结 7 1776
我在风中等你
我在风中等你 2020-12-01 03:49

I am trying to set up a postgres database in a Rails app in Cloud9.

I have followed the instructions here: https://docs.c9.io/setting_up_postgresql.html and set up

7条回答
  •  心在旅途
    2020-12-01 04:23

    A short version when you have rails app prior to creating any databases:

    add the gem 'pg' remove gem sqlite3

    $ bundle install
    $ gem install pg
    

    Then,

    $sudo service postgresql start
    $psql -c "create database myapp_development owner=ubuntu"
    

    as per https://community.c9.io/t/how-do-i-set-up-postgresql-on-c9-for-my-rails-app/2614/4

    Changing myapp for whatever name. Then, copy-paste below, changing myapp for whatever name.

    /myapp/config/database.yml
        development:
          adapter: postgresql
          encoding: unicode
          database: myapp_development
          pool: 5
          username: ubuntu
          password:
          timeout: 5000
    

    As above comments, no password needed, username can stay ubuntu.

    $rake db:migrate
    

    If you're using heroku, you won't need the production section in database.yml

提交回复
热议问题