chore file size column type
This commit is contained in:
+3
-14
@@ -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;
|
||||
|
||||
@@ -338,7 +338,7 @@ model UserFile {
|
||||
name String
|
||||
originalName String?
|
||||
mimeType String
|
||||
size Int
|
||||
size Float
|
||||
path String
|
||||
etag String?
|
||||
storageClass String?
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user