postgresql - rails error: relation already exists -
i'm trying move rails app docker container production , i'm last step of loading production dump container.
i've done backup of current production database
pg_dump pdfcat_production > ~/pdfcat-20170728.dump
i've loaded once before , worked, it's second time failing;
docker-compose run -e 'rails_env=production' app rake db:drop docker-compose run -e 'rails_env=production' app rake db:create cat ~/pdfcat-20170727.dump | docker exec -i 79766cf70617 psql -upostgres
i error;
error: relation "categories" exists error: role "pdfcat" not exist error: relation "categories_id_seq" exists error: role "pdfcat" not exist alter sequence error: relation "clients" exists error: role "pdfcat" not exist error: relation "clients_id_seq" exists error: role "pdfcat" not exist
after finishes these errors cannot load web app.
the loading of second time giving errors because data loaded containers , not getting recreated. need not load data time.
as current situation, can remove containers , begin afresh , time data loading not give errors. remove container, can use docker rm <contianer_id>
, if there problems while stopping or removing container there system restart failproof , stops container. restarting docker service may 1 option.
if want prepare image can load data first time system, can include data loading process inside dockerfile.
Comments
Post a Comment