Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions server/src/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ export const columns = {
'asset_file.type',
'asset_file.isEdited',
'asset_file.isProgressive',
'asset_file.isTransparent',
],
authUser: ['user.id', 'user.name', 'user.email', 'user.isAdmin', 'user.quotaUsageInBytes', 'user.quotaSizeInBytes'],
authApiKey: ['api_key.id', 'api_key.permissions'],
Expand Down
3 changes: 2 additions & 1 deletion server/src/queries/asset.job.repository.sql
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ select
"asset_file"."path",
"asset_file"."type",
"asset_file"."isEdited",
"asset_file"."isProgressive"
"asset_file"."isProgressive",
"asset_file"."isTransparent"
from
"asset_file"
where
Expand Down
11 changes: 9 additions & 2 deletions server/src/repositories/asset.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,10 @@ export class AssetRepository {
}

async upsertFile(
file: Pick<Insertable<AssetFileTable>, 'assetId' | 'path' | 'type' | 'isEdited' | 'isProgressive'>,
file: Pick<
Insertable<AssetFileTable>,
'assetId' | 'path' | 'type' | 'isEdited' | 'isProgressive' | 'isTransparent'
>,
): Promise<void> {
await this.db
.insertInto('asset_file')
Expand All @@ -917,7 +920,10 @@ export class AssetRepository {
}

async upsertFiles(
files: Pick<Insertable<AssetFileTable>, 'assetId' | 'path' | 'type' | 'isEdited' | 'isProgressive'>[],
files: Pick<
Insertable<AssetFileTable>,
'assetId' | 'path' | 'type' | 'isEdited' | 'isProgressive' | 'isTransparent'
>[],
): Promise<void> {
if (files.length === 0) {
return;
Expand All @@ -930,6 +936,7 @@ export class AssetRepository {
oc.columns(['assetId', 'type', 'isEdited']).doUpdateSet((eb) => ({
path: eb.ref('excluded.path'),
isProgressive: eb.ref('excluded.isProgressive'),
isTransparent: eb.ref('excluded.isTransparent'),
})),
)
.execute();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Kysely, sql } from 'kysely';

export async function up(db: Kysely<any>): Promise<void> {
await sql`ALTER TABLE "asset_file" ADD "isTransparent" boolean NOT NULL DEFAULT false;`.execute(db);
}

export async function down(db: Kysely<any>): Promise<void> {
await sql`ALTER TABLE "asset_file" DROP COLUMN "isTransparent";`.execute(db);
}
3 changes: 3 additions & 0 deletions server/src/schema/tables/asset-file.table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,7 @@ export class AssetFileTable {

@Column({ type: 'boolean', default: false })
isProgressive!: Generated<boolean>;

@Column({ type: 'boolean', default: false })
isTransparent!: Generated<boolean>;
}
Loading
Loading