Skip to content

Commit

Permalink
fix: add indexes for statuses: id, account and type
Browse files Browse the repository at this point in the history
  • Loading branch information
sky3d authored and AVVS committed Dec 12, 2022
1 parent d967a7d commit 324ce39
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/migrations/20221121133715_tweet-type-column.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ exports.up = async (knex) => {
await knex.schema.alterTable(kTable, (table) => {
table.bigInteger('type');
});

await knex.schema
.raw(`CREATE INDEX IF NOT EXISTS idx_tweets_id_asc_account_type on ${kTable} using BTREE (id, account, type)`);
await knex.schema
.raw(`CREATE INDEX IF NOT EXISTS idx_tweets_id_desc_account_type on ${kTable} using BTREE (id DESC, account, type)`);
};

exports.down = async (knex) => {

return knex.schema.alterTable(kTable, (table) => {
table.dropIndex(null, 'idx_tweets_id_desc_account_type');
table.dropIndex(null, 'idx_tweets_id_asc_account_type');
table.dropColumn('type');
});
};

0 comments on commit 324ce39

Please sign in to comment.