Skip to content

Commit

Permalink
Added index on status field for posts table
Browse files Browse the repository at this point in the history
  • Loading branch information
vershwal committed May 9, 2024
1 parent 545247a commit 016773c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// For information on writing migrations, see https://www.notion.so/ghost/Database-migrations-eb5b78c435d741d2b34a582d57c24253

const {createNonTransactionalMigration} = require('../../utils');
const {addIndex, dropIndex} = require('../../../schema/commands');

module.exports = createNonTransactionalMigration(
async function up(knex) {
await addIndex('posts', ['status', 'type'], knex);
},
async function down(knex) {
await dropIndex('posts', ['status', 'type'], knex);
}
);
3 changes: 3 additions & 0 deletions ghost/core/core/server/data/schema/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ module.exports = {
show_title_and_feature_image: {type: 'boolean', nullable: false, defaultTo: true},
'@@UNIQUE_CONSTRAINTS@@': [
['slug', 'type']
],
'@@INDEXES@@': [
['status', 'type']
]
},
posts_meta: {
Expand Down
2 changes: 1 addition & 1 deletion ghost/core/test/unit/server/data/schema/integrity.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const validateRouteSettings = require('../../../../../core/server/services/route
*/
describe('DB version integrity', function () {
// Only these variables should need updating
const currentSchemaHash = 'ccf3893bc3f8930f0d1188e646abda6d';
const currentSchemaHash = '59239ddd22c372654e57b33e4c31eb26';
const currentFixturesHash = 'a489d615989eab1023d4b8af0ecee7fd';
const currentSettingsHash = '5c957ceb48c4878767d7d3db484c592d';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
Expand Down

0 comments on commit 016773c

Please sign in to comment.