chore file size column type

This commit is contained in:
oiov
2025-07-12 19:39:55 +08:00
parent 0b72ced8d6
commit bb37643e6d
4 changed files with 8 additions and 17 deletions
+3 -14
View File
@@ -574,20 +574,9 @@ export function generateFileKey(fileName: string, prefix?: string): string {
const SIZE_THRESHOLD = 1000;
export function bytesToStorageValue(bytes: number): number {
if (bytes < SIZE_THRESHOLD) {
return bytes;
} else {
return Math.ceil(bytes / SIZE_THRESHOLD);
}
return bytes / SIZE_THRESHOLD;
}
export function storageValueToBytes(
storageValue: number,
originalBytes?: number,
): number {
if (storageValue < SIZE_THRESHOLD) {
return storageValue;
} else {
return storageValue * SIZE_THRESHOLD;
}
export function storageValueToBytes(storageValue: number): number {
return storageValue * SIZE_THRESHOLD;
}
@@ -32,4 +32,6 @@ ALTER TABLE "plans" ADD COLUMN "stMaxFileSize" TEXT NOT NULL DEFAULT '26214400';
ALTER TABLE "plans" ADD COLUMN "stMaxTotalSize" TEXT NOT NULL DEFAULT '524288000';
ALTER TABLE "plans" ADD COLUMN "stMaxFileCount" INTEGER NOT NULL DEFAULT 1000;
ALTER TABLE "user_files"
ALTER COLUMN size TYPE
FLOAT;
+1 -1
View File
@@ -338,7 +338,7 @@ model UserFile {
name String
originalName String?
mimeType String
size Int
size Float
path String
etag String?
storageClass String?
+1 -1
View File
File diff suppressed because one or more lines are too long