diff --git a/src/migrations/20240208130439-events-revision-id-index.js b/src/migrations/20240208130439-events-revision-id-index.js new file mode 100644 index 0000000000..13357aaecc --- /dev/null +++ b/src/migrations/20240208130439-events-revision-id-index.js @@ -0,0 +1,19 @@ +'use strict'; + +exports.up = function(db, cb) { + db.runSql( + ` + CREATE INDEX IF NOT EXISTS idx_events_feature_type_id ON events (id) + WHERE feature_name IS NOT NULL + OR type IN ('segment-updated', 'feature_import', 'features-imported'); + + `, + cb, + ); +}; + +exports.down = function(db, cb) { + db.runSql(` + DROP INDEX IF EXISTS idx_events_feature_type_id; + `, cb); +};