Fix pg_trgm word similarly threshold even for the first session

This commit is contained in:
Zoe Roux 2025-02-22 18:39:13 +01:00
parent 1bca9f47dd
commit 9b526461c6
4 changed files with 5 additions and 8 deletions

View File

@ -38,10 +38,3 @@ jobs:
env:
JWT_SECRET: "TODO"
POSTGRES_SERVER: localhost
- uses: actions/upload-artifact@v4
with:
name: results
path: auth/out

View File

@ -5,7 +5,8 @@
"dev": "bun --watch src/index.ts",
"build": "bun build src/index.ts --target bun --outdir ./dist",
"start": "NODE_ENV=production bun dist/index.js",
"test": "bun test"
"test": "bun test",
"format": "biome check --write ."
},
"dependencies": {
"@elysiajs/jwt": "^1.2.0",

View File

@ -21,6 +21,7 @@ export const migrate = async () => {
await db.execute(
sql.raw(`
create extension if not exists pg_trgm;
SET pg_trgm.word_similarity_threshold = 0.4;
ALTER DATABASE "${dbConfig.database}" SET pg_trgm.word_similarity_threshold = 0.4;
`),
);
@ -28,4 +29,5 @@ export const migrate = async () => {
migrationsSchema: "kyoo",
migrationsFolder: "./drizzle",
});
console.log(`Database ${dbConfig.database} migrated!`);
};

View File

@ -309,6 +309,7 @@ describe("search", () => {
const [resp, body] = await getMovies({
limit: 2,
query: "bobble",
langs: "en",
});
expectStatus(resp, body).toBe(200);