1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-14 18:27:44 +02:00

add indexes

This commit is contained in:
Laurent Cozic 2021-02-04 22:06:50 +00:00
parent 7ade9b2948
commit 2022b5bc48
2 changed files with 9 additions and 2 deletions

View File

@ -18,6 +18,15 @@ export async function up(db: DbConnection): Promise<any> {
await db.schema.table('files', function(table: Knex.CreateTableBuilder) {
table.string('source_file_id', 32).defaultTo('').notNullable();
});
await db.schema.alterTable('files', function(table: Knex.CreateTableBuilder) {
table.index(['owner_id']);
table.index(['source_file_id']);
});
await db.schema.alterTable('changes', function(table: Knex.CreateTableBuilder) {
table.index(['item_id']);
});
}
export async function down(db: DbConnection): Promise<any> {

View File

@ -72,8 +72,6 @@ export default class ChangeModel extends BaseModel<Change> {
const directory = await fileModel.load(dirId);
if (!directory.is_directory) throw new ErrorUnprocessableEntity(`Item with id "${dirId}" is not a directory.`);
// TODO: Add indexes
// Retrieves the IDs of all the files that have been shared with the
// current user.
const linkedFilesQuery = this