fix migrations, closes !10

This commit is contained in:
finn 2022-06-27 10:00:11 -07:00
parent b5af9d176b
commit 12874dd6dc
2 changed files with 6 additions and 4 deletions

View file

@ -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 {

View file

@ -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 (