Keep old timestamps during data migration
As part of the update to patch_set_approavals, the category names are changed. Doing so causes "ON UPDATE CURRENT_TIMESTAMP" in at least MySQL to replace all of the existing timestamps with the time of the migration. Since the purpose of CURRENT_TIMESTAMP here is to track when the approval vote happened, this is a loss of data. Amend the data migration to include granted=granted in the update list so that anyone running the migration will not lose their data. Change-Id: If80891018eae0fab75770a5aea5a382200e9112f
This commit is contained in:
parent
3ffc86a6a0
commit
5feaa2757a
@ -138,7 +138,8 @@ public class Schema_77 extends SchemaVersion {
|
||||
private void migratePatchSetApprovals(ReviewDb db,
|
||||
LegacyLabelTypes labelTypes) throws SQLException {
|
||||
PreparedStatement stmt = ((JdbcSchema) db).getConnection().prepareStatement(
|
||||
"UPDATE patch_set_approvals SET category_id = ? WHERE category_id = ?");
|
||||
"UPDATE patch_set_approvals SET category_id = ?, granted=granted"
|
||||
+ " WHERE category_id = ?");
|
||||
try {
|
||||
for (LegacyLabelType type : labelTypes.getLegacyLabelTypes()) {
|
||||
stmt.setString(1, type.getName());
|
||||
|
Loading…
Reference in New Issue
Block a user