Can't get PostgreSQL data to show on Heroku - Rails -


i making rails api using jbuilder serve database react app i'm building. using postgresql. can index.json.jbuilder view work on local server:

{  "owners": [    {     "first_name": "alex",     "last_name": "hardy",     "revenue": 100000,     "audit_score": 89,     "passing": true,   },   ........... { 

but these instances not going heroku's server. have created heroku app, pushed app heroku (git push heroku master) , , migrated database with:

heroku run rake db:migrate  

it has stored tables because when run:

heroku pg:info 

i get:

plan:        hobby-dev status:      available connections: 2/20 pg version:  9.6.2 created:     2017-07-26 19:09 utc data size:   7.4 mb tables:      3 rows:        2/10000 (in compliance) fork/follow: unsupported rollback:    unsupported add-on:      postgresql-contoured-63642 

if

heroku console 

and check table owner (owner.new) shows correct properties ("first_name", "last_name"....). but, when go site: https://peaceful-basin-47322.herokuapp.com/owners shows table, none of instances of model:

{     "owners": [] }  

how migrate instances of model heroku?

the data localhost different, data in heroku. if want same need dump data localhost import heroku,

first dump postgres localhost data

pgpassword=mypassword pg_dump -fc --no-acl --no-owner -h localhost -u myuser mydb > mydb.dump 

then upload internet heroku can download it, amazon s3

heroku pg:backups:restore 'https://s3.amazonaws.com/me/items/3h0q/mydb.dump' database_url 

more can read here https://devcenter.heroku.com/articles/heroku-postgres-import-export

rake db:migrate create database tables, without data, if want create data can make seeds.rb , rake db:seed


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -