I had a Rails project on C9 with a SQLite 3 database. Recently I wanted to switch to a PostgreSQL database to be able to run a project on Heroku. All records from the SQLite 3 database were copied to the PostgreSQL database with the Sequel gem, without any issues. All records were passed to the new database and I was able to see it, however, after rebooting my C9 project, and starting the PostgreSQL service, and connecting it to my database, I found that there weren't any records inside the database. Or, it's not connected yet. I don't get it.
Every time I reboot the project, records from the PostgreSQL database disappear, I have to create a new database and migrate it again to see my records. What am I doing wrong?
Here is list of my actions:
sudo service postgresql start
psql -c "create database myapp_development owner=ubuntu"
sequel -C sqlite://db/development.sqlite3 postgres://ubuntu@""/myapp_development
Then update database.yml file records with:
Development:
- adapter: postgresql
- encoding: SQL_ASCII
- database: myapp_development
- pool: 5
- username: ubuntu
- password: password
Then run:
rake db:migrate
After these actions I can run the project and see my records.
After rebooting the project, I've tried to run the following commands:
sudo service postgresql start
psql myapp_development ubuntu
\c
but it does not help me to see any records.
Please advise me if I've missed any command.
Run psql
as the postgres
user:
sudo sudo -u postgres psql -d myapp_development -U ubuntu -W