mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
f12866cf42
* feat(EE): fulltext search in attachments * feat: global search - search filters - attachments search ui - and more * fix import * fix import * rename migration * add GIN index * fix table name * sanitize
30 lines
697 B
TypeScript
30 lines
697 B
TypeScript
import { type Kysely, sql } from 'kysely';
|
|
|
|
export async function up(db: Kysely<any>): Promise<void> {
|
|
await db.schema
|
|
.alterTable('attachments')
|
|
.addColumn('text_content', 'text', (col) => col)
|
|
.addColumn('tsv', sql`tsvector`, (col) => col)
|
|
.execute();
|
|
|
|
await db.schema
|
|
.createIndex('attachments_tsv_idx')
|
|
.on('attachments')
|
|
.using('GIN')
|
|
.column('tsv')
|
|
.execute();
|
|
}
|
|
|
|
export async function down(db: Kysely<any>): Promise<void> {
|
|
await db.schema
|
|
.alterTable('attachments')
|
|
.dropIndex('attachments_tsv_idx')
|
|
.execute();
|
|
|
|
await db.schema
|
|
.alterTable('attachments')
|
|
.dropColumn('text_content')
|
|
.dropColumn('tsv')
|
|
.execute();
|
|
}
|