From 26c4847e266e87bf11ee69acdf88bf96ad173560 Mon Sep 17 00:00:00 2001 From: Edwin Kempin Date: Sat, 30 Sep 2017 10:21:48 +0200 Subject: [PATCH] Schema_152 + Schema_157: Ignore missing index We want to drop the index. If it is already gone it is also fine. On upgrade of my test site these schema migrations failed because the index was missing. In other schema migrations (e.g. Schema_145) we handle missing indexes the same way. Change-Id: I5d26634b08fb8b6852e0fe2303d2f851c650f29b Signed-off-by: Edwin Kempin --- .../main/java/com/google/gerrit/server/schema/Schema_152.java | 2 ++ .../main/java/com/google/gerrit/server/schema/Schema_157.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_152.java b/gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_152.java index 2ed72736f3..c5150a0efb 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_152.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_152.java @@ -36,6 +36,8 @@ public class Schema_152 extends SchemaVersion { SqlDialect dialect = schema.getDialect(); try (StatementExecutor e = newExecutor(db)) { dialect.dropIndex(e, "accounts", "accounts_byFullName"); + } catch (OrmException ex) { + // Ignore. The index did not exist. } } } diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_157.java b/gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_157.java index e232e7a58f..f5c5b599b3 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_157.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_157.java @@ -36,6 +36,8 @@ public class Schema_157 extends SchemaVersion { SqlDialect dialect = schema.getDialect(); try (StatementExecutor e = newExecutor(db)) { dialect.dropIndex(e, "accounts", "accounts_byPreferredEmail"); + } catch (OrmException ex) { + // Ignore. The index did not exist. } } }