From bc475a32eaabc571e842d2bb677bc40fb1f40ef6 Mon Sep 17 00:00:00 2001 From: Steve Larson <9larsons@gmail.com> Date: Mon, 10 Jun 2024 10:12:10 -0500 Subject: [PATCH] Added updated_at index to the posts table ref https://linear.app/tryghost/issue/ONC-82 - added migration for adding a posts.updated_at index The default order by clause is published_at desc. It makes sense that users may want to return the latest updated posts instead of the last published. Currently we don't have an index for this and it makes for slow data fetching. --- .../5.85/2024-06-10-14-53-31-add-posts-updated-at-index.js | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 ghost/core/core/server/data/migrations/versions/5.85/2024-06-10-14-53-31-add-posts-updated-at-index.js diff --git a/ghost/core/core/server/data/migrations/versions/5.85/2024-06-10-14-53-31-add-posts-updated-at-index.js b/ghost/core/core/server/data/migrations/versions/5.85/2024-06-10-14-53-31-add-posts-updated-at-index.js new file mode 100644 index 000000000000..124e86e5005c --- /dev/null +++ b/ghost/core/core/server/data/migrations/versions/5.85/2024-06-10-14-53-31-add-posts-updated-at-index.js @@ -0,0 +1,4 @@ +// For information on writing migrations, see https://www.notion.so/ghost/Database-migrations-eb5b78c435d741d2b34a582d57c24253 +const {createAddIndexMigration} = require('../../utils'); + +module.exports = createAddIndexMigration('posts',['updated_at']); \ No newline at end of file