mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-04 03:27:09 -05:00 
			
		
		
		
	
							parent
							
								
									5122512f19
								
							
						
					
					
						commit
						f99c6feac5
					
				@ -119,8 +119,6 @@ export class DatabaseRepository {
 | 
				
			|||||||
    await sql`CREATE EXTENSION IF NOT EXISTS ${sql.raw(extension)} CASCADE`.execute(this.db);
 | 
					    await sql`CREATE EXTENSION IF NOT EXISTS ${sql.raw(extension)} CASCADE`.execute(this.db);
 | 
				
			||||||
    if (extension === DatabaseExtension.VECTORCHORD) {
 | 
					    if (extension === DatabaseExtension.VECTORCHORD) {
 | 
				
			||||||
      const dbName = sql.id(await this.getDatabaseName());
 | 
					      const dbName = sql.id(await this.getDatabaseName());
 | 
				
			||||||
      await sql`ALTER DATABASE ${dbName} SET vchordrq.prewarm_dim = '512,640,768,1024,1152,1536'`.execute(this.db);
 | 
					 | 
				
			||||||
      await sql`SET vchordrq.prewarm_dim = '512,640,768,1024,1152,1536'`.execute(this.db);
 | 
					 | 
				
			||||||
      await sql`ALTER DATABASE ${dbName} SET vchordrq.probes = 1`.execute(this.db);
 | 
					      await sql`ALTER DATABASE ${dbName} SET vchordrq.probes = 1`.execute(this.db);
 | 
				
			||||||
      await sql`SET vchordrq.probes = 1`.execute(this.db);
 | 
					      await sql`SET vchordrq.probes = 1`.execute(this.db);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,15 @@
 | 
				
			|||||||
 | 
					import { Kysely, sql } from 'kysely';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export async function up(db: Kysely<any>): Promise<void> {
 | 
				
			||||||
 | 
					  const { rows } = await sql<{ db: string }>`SELECT current_database() as db;`.execute(db);
 | 
				
			||||||
 | 
					  const databaseName = rows[0].db;
 | 
				
			||||||
 | 
					  await sql.raw(`ALTER DATABASE "${databaseName}" RESET vchordrq.prewarm_dim;`).execute(db);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export async function down(db: Kysely<any>): Promise<void> {
 | 
				
			||||||
 | 
					  const { rows } = await sql<{ db: string }>`SELECT current_database() as db;`.execute(db);
 | 
				
			||||||
 | 
					  const databaseName = rows[0].db;
 | 
				
			||||||
 | 
					  await sql
 | 
				
			||||||
 | 
					    .raw(`ALTER DATABASE "${databaseName}" SET vchordrq.prewarm_dim = '512,640,768,1024,1152,1536';`)
 | 
				
			||||||
 | 
					    .execute(db);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user