feat: Refactor storage adapter and mount handling; migrate mounts to storage adapters; enhance SideNav; implement database migration scripts

This commit is contained in:
shiyu
2025-08-28 12:59:24 +08:00
parent bfa8898931
commit 62a1c5810d
16 changed files with 163 additions and 262 deletions

View File

@@ -8,25 +8,13 @@ class StorageAdapter(Model):
type = fields.CharField(max_length=30)
config = fields.JSONField()
enabled = fields.BooleanField(default=True)
mounts: fields.ReverseRelation["Mount"]
path = fields.CharField(max_length=255, unique=True)
sub_path = fields.CharField(max_length=1024, null=True)
class Meta:
table = "storage_adapters"
class Mount(Model):
id = fields.IntField(pk=True)
path = fields.CharField(max_length=255, unique=True)
sub_path = fields.CharField(max_length=1024, null=True)
adapter: fields.ForeignKeyRelation[StorageAdapter] = fields.ForeignKeyField(
"models.StorageAdapter", related_name="mounts", on_delete=fields.CASCADE
)
enabled = fields.BooleanField(default=True)
class Meta:
table = "mounts"
class UserAccount(Model):
id = fields.IntField(pk=True)
username = fields.CharField(max_length=50, unique=True)