removed not needed "refcount" column

This commit is contained in:
bigcat88 2025-08-27 21:36:31 +03:00
parent eb7008a4d3
commit 871e41aec6
No known key found for this signature in database
GPG Key ID: 1F0BF0EC3CF22721
3 changed files with 1 additions and 5 deletions

View File

@ -22,11 +22,9 @@ def upgrade() -> None:
sa.Column("hash", sa.String(length=256), primary_key=True),
sa.Column("size_bytes", sa.BigInteger(), nullable=False, server_default="0"),
sa.Column("mime_type", sa.String(length=255), nullable=True),
sa.Column("refcount", sa.BigInteger(), nullable=False, server_default="0"),
sa.Column("created_at", sa.DateTime(timezone=False), nullable=False),
sa.Column("updated_at", sa.DateTime(timezone=False), nullable=False),
sa.CheckConstraint("size_bytes >= 0", name="ck_assets_size_nonneg"),
sa.CheckConstraint("refcount >= 0", name="ck_assets_refcount_nonneg"),
)
op.create_index("ix_assets_mime_type", "assets", ["mime_type"])

View File

@ -44,7 +44,6 @@ class Asset(Base):
hash: Mapped[str] = mapped_column(String(256), primary_key=True)
size_bytes: Mapped[int] = mapped_column(BigInteger, nullable=False, default=0)
mime_type: Mapped[str | None] = mapped_column(String(255))
refcount: Mapped[int] = mapped_column(BigInteger, nullable=False, default=0)
created_at: Mapped[datetime] = mapped_column(
DateTime(timezone=False), nullable=False, default=utcnow
)

View File

@ -89,7 +89,7 @@ async def ingest_fs_asset(
- Insert AssetCacheState if missing; else update mtime_ns if different.
Optionally (when info_name is provided):
- Create an AssetInfo (no refcount changes).
- Create an AssetInfo.
- Link provided tags to that AssetInfo.
* If the require_existing_tags=True, raises ValueError if any tag does not exist in `tags` table.
* If False (default), create unknown tags.
@ -122,7 +122,6 @@ async def ingest_fs_asset(
hash=asset_hash,
size_bytes=int(size_bytes),
mime_type=mime_type,
refcount=0,
created_at=datetime_now,
updated_at=datetime_now,
)