mirror of
https://github.com/immich-app/immich
synced 2025-06-07 06:28:25 +00:00
fix(server): handle startup reindexing after failed model change (#18688)
drop constraint
This commit is contained in:
parent
6abcfaef99
commit
4794a1a092
@ -247,7 +247,10 @@ export class DatabaseRepository {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const dimSize = await this.getDimensionSize(table);
|
const dimSize = await this.getDimensionSize(table);
|
||||||
await sql`DROP INDEX IF EXISTS ${sql.raw(indexName)}`.execute(this.db);
|
await this.db.schema.dropIndex(indexName).ifExists().execute();
|
||||||
|
if (table === 'smart_search') {
|
||||||
|
await this.db.schema.alterTable(table).dropConstraint('dim_size_constraint').ifExists().execute();
|
||||||
|
}
|
||||||
await this.db.transaction().execute(async (tx) => {
|
await this.db.transaction().execute(async (tx) => {
|
||||||
if (!rows.some((row) => row.columnName === 'embedding')) {
|
if (!rows.some((row) => row.columnName === 'embedding')) {
|
||||||
this.logger.warn(`Column 'embedding' does not exist in table '${table}', truncating and adding column.`);
|
this.logger.warn(`Column 'embedding' does not exist in table '${table}', truncating and adding column.`);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user