mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-25 07:59:03 +00:00
feat(asset): decouple logical assets from physical storage with StorageKey and implement O(1) copy
This commit is contained in:
+13
-1
@@ -347,7 +347,6 @@ model Asset {
|
||||
id String @id @default(ulid())
|
||||
name String @default("")
|
||||
nameNgram String[] @default([]) @map("name_ngram")
|
||||
key String?
|
||||
type AssetType
|
||||
mediaType String? @map("media_type")
|
||||
fileCount Int @default(0) @map("file_count")
|
||||
@@ -370,6 +369,9 @@ model Asset {
|
||||
target Asset? @relation("SymlinkTarget", fields: [targetId], references: [id])
|
||||
symlinks Asset[] @relation("SymlinkTarget")
|
||||
|
||||
storageKeyId String? @map("storage_key_id")
|
||||
storageKey StorageKey? @relation(fields: [storageKeyId], references: [id])
|
||||
|
||||
metadataValues AssetMetadataValue[] @relation("AssetToMetadataValues")
|
||||
|
||||
creatorId String? @map("creator_id")
|
||||
@@ -403,6 +405,16 @@ model Asset {
|
||||
@@unique([parentId, targetId], name: "parentIdTargetId")
|
||||
}
|
||||
|
||||
model StorageKey {
|
||||
id String @id @default(ulid())
|
||||
key String @unique
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
assets Asset[]
|
||||
|
||||
@@map("storage_keys")
|
||||
}
|
||||
|
||||
model AssetMetadataValue {
|
||||
id String @id @default(ulid())
|
||||
assetId String @map("asset_id")
|
||||
|
||||
Reference in New Issue
Block a user