hasTable('systemtag_object_mapping')) { $table = $schema->getTable('systemtag_object_mapping'); if (!$table->hasIndex('memories_type_tagid')) { $table->addIndex(['objecttype', 'systemtagid'], 'memories_type_tagid'); $shouldMigrate = true; } } // Add index on recognize detections for file id to speed up joins if ($schema->hasTable('recognize_face_detections')) { $table = $schema->getTable('recognize_face_detections'); if (!$table->hasIndex('memories_file_id')) { $table->addIndex(['file_id'], 'memories_file_id'); $shouldMigrate = true; } } // Migrate if ($shouldMigrate && null !== $connection) { $connection->migrateToSchema($schema->getWrappedSchema()); } return $schema; } }