Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow up Question - dumping/importing homer_config mapping_schema #636

Closed
jagnetta opened this issue Apr 23, 2024 · 3 comments
Closed

Follow up Question - dumping/importing homer_config mapping_schema #636

jagnetta opened this issue Apr 23, 2024 · 3 comments

Comments

@jagnetta
Copy link

Good day,

I'm following up on a question about trying to make the field mappings portable across installations. It's imperative that an automated process be created, so I'm focusing on this type of operation:

Server 1:
sudo -u postgres pg_dump homer_config > homer_config
scp homer_config Server2:

Server 2:
sudo -u postgres psql -c "drop database homer_config;"
sudo -u postgres psql -c "create database homer_config;"
sudo -u postgres psql < /tmp/homer_config

Even after the drop, I get errors such as this:
ERROR: duplicate key value violates unique constraint "mapping_schema_pkey"

NB: I do see references to my custom mappings in the dump file.

I'm not sure why there are still relations or tables after the DB drops that the import should complain about duplication. But that's because I'm no psql expert at all.

If you happen to have a 1/2 way decent procedure on how to do something like this I'd appreciate it. In the meantime I'm googling as hard as I can!! :)

Thanks,
Jim Agnetta

Copy link

Your report is appreciated. Please star this repository to motivate its developers! ⭐

@lmangani lmangani transferred this issue from sipcapture/homer-app Apr 23, 2024
@jagnetta
Copy link
Author

jagnetta commented Apr 23, 2024

This seems to work better:

Server 1:
sudo -u postgres pg_dump homer_config > homer_config
scp homer_config Server2:/tmp/homer_config

Server 2:
sudo -u postgres psql -c "DROP TABLE mapping_schema;"
sudo -u postgres psql < /tmp/homer_config

Any tables that already exist are protected, and mapping_schema gets imported.

@jagnetta
Copy link
Author

I'm pretty sure this can be closed. If you have something more elegant, please advise. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants