diff --git a/db/migrations/5.1.29_add_index_resource_booking_intervals.php b/db/migrations/5.1.29_add_index_resource_booking_intervals.php
new file mode 100644
index 0000000000000000000000000000000000000000..d819125c38189ea51305fa82385482a6c969b486
--- /dev/null
+++ b/db/migrations/5.1.29_add_index_resource_booking_intervals.php
@@ -0,0 +1,42 @@
+<?php
+
+class AddIndexResourceBookingIntervals extends Migration
+{
+    public function description()
+    {
+        return 'add index for booking_id to resource_booking_intervals';
+    }
+
+    public function up()
+    {
+        $db = DBManager::get();
+
+        // avoid running this migration twice
+        $sql = "SHOW INDEX FROM resource_booking_intervals WHERE Key_name = 'booking_id'";
+        $result = $db->query($sql);
+
+        if ($result && $result->rowCount() > 0) {
+            return;
+        }
+
+        // index "assign_object_id" may not exist (depending on upgrade path)
+        $sql = "SHOW INDEX FROM resource_booking_intervals WHERE Key_name = 'assign_object_id'";
+        $result = $db->query($sql);
+
+        if ($result && $result->rowCount() > 0) {
+            $sql = 'ALTER TABLE resource_booking_intervals DROP INDEX assign_object_id';
+            $db->exec($sql);
+        }
+
+        $sql = 'ALTER TABLE resource_booking_intervals ADD INDEX booking_id (booking_id)';
+        $db->exec($sql);
+    }
+
+    public function down()
+    {
+        $db = DBManager::get();
+
+        $query = 'ALTER TABLE resource_booking_intervals DROP INDEX booking_id';
+        $db->exec($query);
+    }
+}