From 6cfc15ad6c3c572af6a6b0009a2dabe254f26e31 Mon Sep 17 00:00:00 2001 From: vrana Date: Thu, 8 Nov 2012 11:17:28 -0800 Subject: [PATCH] Make Lisk counters patch more robust Summary: We need to revert this patch and we will need to re-apply it later. We can't drop the table and delete these rows as we need to run both versions for a temporary period. Test Plan: Applied it. Reviewers: epriestley, nh Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3924 --- resources/sql/patches/liskcounters.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/resources/sql/patches/liskcounters.php b/resources/sql/patches/liskcounters.php index 1cfac2c99c..6166640c24 100644 --- a/resources/sql/patches/liskcounters.php +++ b/resources/sql/patches/liskcounters.php @@ -29,10 +29,12 @@ $initial_counter = max((int)$active_auto, (int)$active_max, (int)$archive_max); queryfx( $conn_w, - 'INSERT IGNORE INTO %T (counterName, counterValue) - VALUES (%s, %d)', + 'INSERT INTO %T (counterName, counterValue) + VALUES (%s, %d) + ON DUPLICATE KEY UPDATE counterValue = %d', LiskDAO::COUNTER_TABLE_NAME, $active_table->getTableName(), + $initial_counter + 1, $initial_counter + 1); // Drop AUTO_INCREMENT from the ID column.