-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Maud Royer <hello@maudroyer.fr>
- Loading branch information
Showing
7 changed files
with
285 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Kysely, sql } from "kysely"; | ||
|
||
export async function up(db: Kysely<any>): Promise<void> { | ||
await sql`CREATE EXTENSION IF NOT EXISTS pg_trgm`.execute(db); | ||
await sql`CREATE EXTENSION IF NOT EXISTS unaccent`.execute(db); | ||
|
||
await db.schema | ||
.createTable("search_index") | ||
.addColumn("token", "text") | ||
.addColumn("table_name", "text") | ||
.addColumn("id", "text") | ||
.execute(); | ||
|
||
await db.schema | ||
.createIndex("search_index_trgm") | ||
.on("search_index") | ||
.using("GIN (token gin_trgm_ops)") | ||
.execute(); | ||
} | ||
|
||
export async function down(db: Kysely<any>): Promise<void> { | ||
await db.schema.dropTable("search_index").execute(); | ||
|
||
await sql`DROP EXTENSION IF EXISTS unaccent`.execute(db); | ||
await sql`DROP EXTENSION IF EXISTS pg_trgm`.execute(db); | ||
} |
Oops, something went wrong.