Last active
September 29, 2021 12:12
-
-
Save asachdeva/76d71dc235c0dafdec4e7b9235cc189e to your computer and use it in GitHub Desktop.
Import Vendor Links From Prod to Dev Account
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Log on to Prod instance in a terminal on root of lanely repo: | |
./bin/prod_db | |
Reference: https://github.com/rcrdclub/lanley#read-only-access-to-devprod-dbs | |
2. Run \copy command on your favorite PGCLI client: (This copies Bmi Links and updates the group_id to be hardcoded to a specific group_id for the dev account this needs to be linked to) | |
\copy (SELECT id, '01d95391-d582-4ff3-a375-1fcef7f867aa', vendor_account_id, login_name, login_password, created_at, updated_at, enabled, vendor from vendor_link where vendor='bmi' and login_name IS NOT NULL and login_password IS NOT NULL and enabled='t') to '/home/asachdeva/bmilinks.csv' with csv | |
3. Log out of Prod instance | |
4. Log into Dev Instance with Read/Write capabilities: | |
gcloud sql connect common-dev --user=hifi --database=hifi | |
Reference: https://github.com/rcrdclub/lanley#read-write-access-to-devprod-dbs | |
5. Insert rows into Dev Instance: (Note: There is no Semicolon after CSV in \copy command) | |
\copy vendor_link FROM '/home/asachdeva/bmilinks.csv' DELIMITER ',' CSV | |
6. To delete vendor_links from dev into dev instance with credentials like in 4 for either dev or prod | |
delete * from vendor_link where group_id='01d95391-d582-4ff3-a375-1fcef7f867aa' and vendor='bmi' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment