Created
March 4, 2022 22:00
-
-
Save asachdeva/60558bb46179d0cc858e631f73d0ad0a to your computer and use it in GitHub Desktop.
Migrate Data from cosmos-dev to cosmos-prod
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
Request: Move VendorLink ccc40b92-3894-4b30-9515-37116d018136 from +18002221111(dev) to +13238419525(prod) and the CD 'Custom dash test' | |
Steps: | |
1] Extract group_id for user with phone_number of +13238419525 in prod | |
Log on to Prod instance in a terminal on root of lanely repo: | |
./bin/prod_db | |
Run the query select a.default_group_id from "account" a left join "user" u on u.id = a.user_id where u.phone_number='+13238419525'; | |
2] Extract the data to ingest into Prod as CSV's | |
Log on to Dev instance in a terminal on root of lanely repo: | |
./bin/dev_db | |
Extract the vendor_link -- | |
\copy (SELECT id, '01d95391-d582-4ff3-a375-1fcef7f867aa', vendor_account_id, login_name, login_password, created_at, updated_at, enabled, vendor, last_job,last_successful_job from vendor_link where id='ccc40b92-3894-4b30-9515-37116d018136') to '/home/asachdeva/vendor_link.csv' with csv | |
Extract the vendor_link_subaccount -- | |
\copy (SELECT id, vendor_link_id, name, metadata, enabled, created_at, updated_at, category from vendor_link_subaccount where vendor_link_id='ccc40b92-3894-4b30-9515-37116d018136') to '/home/asachdeva/vendor_link_subaccount.csv' with csv | |
Extract the vendor_link_session -- | |
\copy (SELECT id, vendor_link_id, session, created_at from vendor_link_session where vendor_link_id='ccc40b92-3894-4b30-9515-37116d018136') to '/home/asachdeva/vendor_link_session.csv' with csv | |
Extract the vendor_job | |
\copy (SELECT id, vendor_link_id, created_at, auth_started_at, security_question_required, security_question_incorrect, two_fa_choice_required, two_fa_code_required, sync_started_at, sync_completed_at, bad_credentials, failure, error, need_to_visit_site, two_fa_choice_made, two_fa_code_incorrect, two_fa_code_entered from vendor_job where vendor_link_id='ccc40b92-3894-4b30-9515-37116d018136') to '/home/asachdeva/vendor_job.csv' with csv | |
Extract the breakdown data | |
\copy (SELECT job_id, subaccount_link_id, vendor, royalty, country, source, project, currency, amount, sale_at, statement_at, processed_at from breakdown where job_id='e34616a5-663f-4bd2-9c22-39cdc1bbeb0b') to '/home/asachdeva/breakdown.csv' with csv | |
Extract the dashboard data | |
\copy (SELECT id, 'fc9fee32-e3ba-4c68-83bc-5f1c0eb05ee9', '01d95391-d582-4ff3-a375-1fcef7f867aa', title, vendor_link_ids, subaccount_link_ids, created_at, updated_at from dashboard where title='custom dash test') to '/home/asachdeva/dashboard.csv' with csv | |
Extract the statement data | |
\copy (SELECT id, '01d95391-d582-4ff3-a375-1fcef7f867aa', vendor_link_id, date, name, created_at, subaccount_link_id, job_id, file_type from statement where vendor_link_id='ccc40b92-3894-4b30-9515-37116d018136') to '/home/asachdeva/statement.csv' with csv | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment