Skip to content

Commit

Permalink
Fix 1.x to 2.x migration script (#286)
Browse files Browse the repository at this point in the history
### What

Fix 1.x to 2.x migration script.

### Why

The field name was updated from tenant.distribution_account to tenant.distribution_account_address.
  • Loading branch information
marcelosalloum authored May 10, 2024
1 parent b3786f7 commit 5fb125d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dev/migrate_1.1.6_to_2.0.0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,20 +144,20 @@ INSERT INTO sdp_${tenant}.messages SELECT * FROM public.messages;
------ 2.3.1: add new columns to the transaction_submitter table and populate them
ALTER TABLE public.submitter_transactions
ADD COLUMN tenant_id VARCHAR(36),
ADD COLUMN distribution_account VARCHAR(56);
ADD COLUMN distribution_account_address VARCHAR(56);
WITH SelectedTenant AS (
SELECT id AS tenant_id, distribution_account
SELECT id AS tenant_id, distribution_account_address
FROM admin.tenants
LIMIT 1
)
UPDATE public.submitter_transactions SET tenant_id = (SELECT tenant_id FROM SelectedTenant), distribution_account = (SELECT distribution_account FROM SelectedTenant);
UPDATE public.submitter_transactions SET tenant_id = (SELECT tenant_id FROM SelectedTenant), distribution_account_address = (SELECT distribution_account_address FROM SelectedTenant);
------ 2.3.2: copy values to the new table
INSERT INTO tss.submitter_transactions
SELECT
id, external_id,
status::text::tss.transaction_status AS status,
status_history, status_message, asset_code, asset_issuer, amount, destination, created_at, updated_at, locked_at, started_at, sent_at, completed_at, synced_at, locked_until_ledger_number, stellar_transaction_hash, attempts_count, xdr_sent, xdr_received, tenant_id, distribution_account
status_history, status_message, asset_code, asset_issuer, amount, destination, created_at, updated_at, locked_at, started_at, sent_at, completed_at, synced_at, locked_until_ledger_number, stellar_transaction_hash, attempts_count, xdr_sent, xdr_received, tenant_id, distribution_account_address
FROM public.submitter_transactions;
Expand Down

0 comments on commit 5fb125d

Please sign in to comment.