1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +01:00

Allow lisk to preserve primary autoincrement keys so I can migrate a billion

zillion rows without disrupting four years of history.
This commit is contained in:
epriestley 2011-04-08 00:02:52 -07:00
parent c797f9511a
commit 73bf36505b

View file

@ -794,10 +794,14 @@ abstract class LiskDAO {
$id_mechanism = $this->getConfigOption(self::CONFIG_IDS); $id_mechanism = $this->getConfigOption(self::CONFIG_IDS);
switch ($id_mechanism) { switch ($id_mechanism) {
// If we are using autoincrement IDs, let MySQL assign the value for the
// ID column.
case self::IDS_AUTOINCREMENT: 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; break;
case self::IDS_PHID: case self::IDS_PHID:
if (empty($data[$this->getIDKeyForUse()])) { if (empty($data[$this->getIDKeyForUse()])) {