From 12874dd6dcdff2e667383601016ec85ff6f50b34 Mon Sep 17 00:00:00 2001 From: finn Date: Mon, 27 Jun 2022 10:00:11 -0700 Subject: [PATCH] fix migrations, closes !10 --- cmd/signaldctl/cmd/db/migrate.go | 7 ++++--- cmd/signaldctl/cmd/db/postgres.go | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/signaldctl/cmd/db/migrate.go b/cmd/signaldctl/cmd/db/migrate.go index 5bac893..7d92f2d 100644 --- a/cmd/signaldctl/cmd/db/migrate.go +++ b/cmd/signaldctl/cmd/db/migrate.go @@ -32,6 +32,7 @@ var ( {InstalledRank: 3, Version: "13", Description: "recipient registration status", Script: "V13__recipient_registration_status.sql", Checksum: 405376321}, {InstalledRank: 4, Version: "14", Description: "multiple identity keys per account", Script: "V14__multiple_identity_keys_per_account.sql", Checksum: -1635788950}, {InstalledRank: 5, Version: "15", Description: "profiles tables", Script: "V15__profiles_tables.sql", Checksum: 809686180}, + {InstalledRank: 6, Version: "16", Description: "destination uuid in envelope", Script: "V16__destination_uuid_in_envelope.sql", Checksum: -566452172}, } sqlitePath string @@ -269,7 +270,7 @@ func moveAccounts(source *sql.DB, dest *sql.DB) error { if err != nil { return err } - _, err = dest.Exec("INSERT INTO signald_accounts (uuid, e164, server) VALUES ($1, $2, $3, $4)", accountUUID, e164, server) + _, err = dest.Exec("INSERT INTO signald_accounts (uuid, e164, server) VALUES ($1, $2, $3)", accountUUID, e164, server) if err != nil { return err } @@ -668,7 +669,7 @@ func moveProfileKeys(source *sql.DB, dest *sql.DB) error { _, err = dest.Exec(` INSERT INTO signald_profile_keys (account_uuid, recipient, profile_key, profile_key_credential, request_pending, unidentified_access_mode) - VALUES ($1, $2, $3, $4, $5, $6, $7) + VALUES ($1, $2, $3, $4, $5, $6) `, accountUUID, recipient, profile_key, profile_key_credential, request_pending, unidentified_access_mode) if err != nil { return err @@ -694,7 +695,7 @@ func moveProfiles(source *sql.DB, dest *sql.DB) error { about string emoji string payment_address []byte - badges string + badges sql.NullString ) err = rows.Scan(&accountUUID, &recipient, &last_update, &given_name, &family_name, &about, &emoji, &payment_address, &badges) if err != nil { diff --git a/cmd/signaldctl/cmd/db/postgres.go b/cmd/signaldctl/cmd/db/postgres.go index 5f7c2b3..abc8594 100644 --- a/cmd/signaldctl/cmd/db/postgres.go +++ b/cmd/signaldctl/cmd/db/postgres.go @@ -29,7 +29,8 @@ var ( legacy_message BYTEA, server_received_timestamp BIGINT, server_delivered_timestamp BIGINT, - server_uuid UUID + server_uuid UUID, + destination_uuid TEXT ); CREATE TABLE signald_servers (