mirror of
https://github.com/immich-app/immich.git
synced 2025-01-21 00:52:43 -05:00
fix: version history sql (#15321)
This commit is contained in:
parent
3da750117f
commit
36eef9807b
2 changed files with 13 additions and 5 deletions
|
@ -15,3 +15,11 @@ from
|
||||||
"version_history"
|
"version_history"
|
||||||
order by
|
order by
|
||||||
"createdAt" desc
|
"createdAt" desc
|
||||||
|
|
||||||
|
-- VersionHistoryRepository.create
|
||||||
|
insert into
|
||||||
|
"version_history" ("version")
|
||||||
|
values
|
||||||
|
($1)
|
||||||
|
returning
|
||||||
|
*
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { Kysely } from 'kysely';
|
import { Insertable, Kysely } from 'kysely';
|
||||||
import { InjectKysely } from 'nestjs-kysely';
|
import { InjectKysely } from 'nestjs-kysely';
|
||||||
import { DB } from 'src/db';
|
import { DB, VersionHistory } from 'src/db';
|
||||||
import { DummyValue, GenerateSql } from 'src/decorators';
|
import { GenerateSql } from 'src/decorators';
|
||||||
import { VersionHistoryEntity } from 'src/entities/version-history.entity';
|
import { VersionHistoryEntity } from 'src/entities/version-history.entity';
|
||||||
import { IVersionHistoryRepository } from 'src/interfaces/version-history.interface';
|
import { IVersionHistoryRepository } from 'src/interfaces/version-history.interface';
|
||||||
|
|
||||||
|
@ -20,8 +20,8 @@ export class VersionHistoryRepository implements IVersionHistoryRepository {
|
||||||
return this.db.selectFrom('version_history').selectAll().orderBy('createdAt', 'desc').executeTakeFirst();
|
return this.db.selectFrom('version_history').selectAll().orderBy('createdAt', 'desc').executeTakeFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GenerateSql({ params: [DummyValue.STRING] })
|
@GenerateSql({ params: [{ version: 'v1.123.0' }] })
|
||||||
create(version: Omit<VersionHistoryEntity, 'id' | 'createdAt'>): Promise<VersionHistoryEntity> {
|
create(version: Insertable<VersionHistory>): Promise<VersionHistoryEntity> {
|
||||||
return this.db.insertInto('version_history').values(version).returningAll().executeTakeFirstOrThrow();
|
return this.db.insertInto('version_history').values(version).returningAll().executeTakeFirstOrThrow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue