feat: schema-check (#25904)

This commit is contained in:
Jason Rasmussen
2026-02-12 17:59:00 -05:00
committed by GitHub
parent 7413356a2f
commit 8ef4e4d452
37 changed files with 449 additions and 213 deletions

View File

@@ -168,6 +168,8 @@ export interface Migrations {
}
export interface DB {
kysely_migrations: { timestamp: string; name: string };
activity: ActivityTable;
album: AlbumTable;

View File

@@ -1,4 +1,5 @@
import { Kysely, sql } from 'kysely';
import { ErrorMessages } from 'src/constants';
import { DatabaseExtension } from 'src/enum';
import { getVectorExtension } from 'src/repositories/database.repository';
import { LoggingRepository } from 'src/repositories/logging.repository';
@@ -16,9 +17,7 @@ export async function up(db: Kysely<any>): Promise<void> {
rows: [lastMigration],
} = await lastMigrationSql.execute(db);
if (lastMigration?.name !== 'AddMissingIndex1744910873956') {
throw new Error(
'Invalid upgrade path. For more information, see https://docs.immich.app/errors/#typeorm-upgrade',
);
throw new Error(ErrorMessages.TypeOrmUpgrade);
}
logger.log('Database has up to date TypeORM migrations, skipping initial Kysely migration');
return;