Skip to content

Commit 2a4e93d

Browse files
committed
feat: add isTransparent to db
1 parent 9089af6 commit 2a4e93d

File tree

6 files changed

+87
-5
lines changed

6 files changed

+87
-5
lines changed

server/src/database.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ export const columns = {
352352
'asset_file.type',
353353
'asset_file.isEdited',
354354
'asset_file.isProgressive',
355+
'asset_file.isTransparent',
355356
],
356357
authUser: ['user.id', 'user.name', 'user.email', 'user.isAdmin', 'user.quotaUsageInBytes', 'user.quotaSizeInBytes'],
357358
authApiKey: ['api_key.id', 'api_key.permissions'],

server/src/repositories/asset.repository.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,10 @@ export class AssetRepository {
903903
}
904904

905905
async upsertFile(
906-
file: Pick<Insertable<AssetFileTable>, 'assetId' | 'path' | 'type' | 'isEdited' | 'isProgressive'>,
906+
file: Pick<
907+
Insertable<AssetFileTable>,
908+
'assetId' | 'path' | 'type' | 'isEdited' | 'isProgressive' | 'isTransparent'
909+
>,
907910
): Promise<void> {
908911
await this.db
909912
.insertInto('asset_file')
@@ -917,7 +920,10 @@ export class AssetRepository {
917920
}
918921

919922
async upsertFiles(
920-
files: Pick<Insertable<AssetFileTable>, 'assetId' | 'path' | 'type' | 'isEdited' | 'isProgressive'>[],
923+
files: Pick<
924+
Insertable<AssetFileTable>,
925+
'assetId' | 'path' | 'type' | 'isEdited' | 'isProgressive' | 'isTransparent'
926+
>[],
921927
): Promise<void> {
922928
if (files.length === 0) {
923929
return;
@@ -930,6 +936,7 @@ export class AssetRepository {
930936
oc.columns(['assetId', 'type', 'isEdited']).doUpdateSet((eb) => ({
931937
path: eb.ref('excluded.path'),
932938
isProgressive: eb.ref('excluded.isProgressive'),
939+
isTransparent: eb.ref('excluded.isTransparent'),
933940
})),
934941
)
935942
.execute();
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Kysely, sql } from 'kysely';
2+
3+
export async function up(db: Kysely<any>): Promise<void> {
4+
await sql`ALTER TABLE "asset_file" ADD "isTransparent" boolean NOT NULL DEFAULT false;`.execute(db);
5+
}
6+
7+
export async function down(db: Kysely<any>): Promise<void> {
8+
await sql`ALTER TABLE "asset_file" DROP COLUMN "isTransparent";`.execute(db);
9+
}

server/src/schema/tables/asset-file.table.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,7 @@ export class AssetFileTable {
4343

4444
@Column({ type: 'boolean', default: false })
4545
isProgressive!: Generated<boolean>;
46+
47+
@Column({ type: 'boolean', default: false })
48+
isTransparent!: Generated<boolean>;
4649
}

0 commit comments

Comments
 (0)