diff --git a/src/storage/lisk/dao/LiskDAO.php b/src/storage/lisk/dao/LiskDAO.php index 53b78b1212..69d5cfae1a 100644 --- a/src/storage/lisk/dao/LiskDAO.php +++ b/src/storage/lisk/dao/LiskDAO.php @@ -794,10 +794,14 @@ abstract class LiskDAO { $id_mechanism = $this->getConfigOption(self::CONFIG_IDS); switch ($id_mechanism) { - // If we are using autoincrement IDs, let MySQL assign the value for the - // ID column. case self::IDS_AUTOINCREMENT: - unset($data[$this->getIDKeyForUse()]); + // If we are using autoincrement IDs, let MySQL assign the value for the + // ID column, if it is empty. If the caller has explicitly provided a + // value, use it. + $id_key = $this->getIDKeyForUse(); + if (empty($data[$id_key])) { + unset($data[$id_key]); + } break; case self::IDS_PHID: if (empty($data[$this->getIDKeyForUse()])) {