diff --git a/cmd/signaldctl/cmd/db/migrate.go b/cmd/signaldctl/cmd/db/migrate.go index 7c57dd8..bad9eb0 100644 --- a/cmd/signaldctl/cmd/db/migrate.go +++ b/cmd/signaldctl/cmd/db/migrate.go @@ -230,6 +230,12 @@ func moveRecipients(source *sql.DB, dest *sql.DB) error { return err } } + + // start new rowids one above the current max value + _, err = dest.Exec("SELECT setval(pg_get_serial_sequence('signald_recipients', 'rowid', (SELECT MAX(rowid) FROM signald_recipients)+1);") + if err != nil { + return err + } return nil } @@ -494,6 +500,12 @@ func moveGroups(source *sql.DB, dest *sql.DB) error { return err } } + + // start new rowids one above the current max value + _, err = dest.Exec("SELECT setval(pg_get_serial_sequence('signald_groups', 'rowid', (SELECT MAX(rowid) FROM signald_groups)+1);") + if err != nil { + return err + } return nil }