rm FULLTEXT, change value to string, add next_update_at

Signed-off-by: tonedef <kobylk@gmail.com>
This commit is contained in:
tonedef
2022-11-29 20:28:59 -08:00
parent ed29fad6da
commit da94f4f1a5
3 changed files with 8 additions and 7 deletions
@@ -23,7 +23,7 @@ exports.up = async function up(knex) {
// Sqlite does not support alter column.
if (!knex.client.config.client.includes('sqlite3')) {
await knex.schema.alterTable('entities_search', table => {
table.text('value').nullable().alter({ alterType: true });
table.string('value').nullable().alter({ alterType: true });
});
}
};
@@ -21,11 +21,8 @@
*/
exports.up = async function up(knex) {
await knex.schema.alterTable('entities_search', table => {
const options = knex.client.config.client.includes('mysql')
? { indexType: 'FULLTEXT' }
: {};
table.index(['key'], 'entities_search_key', options);
table.index(['value'], 'entities_search_value', options);
table.index(['key'], 'entities_search_key');
table.index(['value'], 'entities_search_value');
});
};
@@ -267,7 +267,10 @@ export class DefaultEntitiesCatalog implements EntitiesCatalog {
.select('refresh_state_references.source_entity_ref');
});
await this.database<DbRefreshStateRow>('refresh_state')
.update({ result_hash: 'child-was-deleted' })
.update({
result_hash: 'child-was-deleted',
next_update_at: this.database.fn.now(),
})
.whereIn(
'entity_id',
results.map(key => key.entity_id),
@@ -276,6 +279,7 @@ export class DefaultEntitiesCatalog implements EntitiesCatalog {
await this.database<DbRefreshStateRow>('refresh_state')
.update({
result_hash: 'child-was-deleted',
next_update_at: this.database.fn.now(),
})
.whereIn('entity_ref', function parents(builder) {
return builder