reset the value generator for SERIAL columns after import
This commit is contained in:
parent
9a371b8f91
commit
17f823064f
1 changed files with 12 additions and 0 deletions
|
@ -230,6 +230,12 @@ func moveRecipients(source *sql.DB, dest *sql.DB) error {
|
||||||
return err
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -494,6 +500,12 @@ func moveGroups(source *sql.DB, dest *sql.DB) error {
|
||||||
return err
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue