Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: 🐛 Clean removal of output files #6986

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Add file ref_count

Revision ID: a80132007436
Revises: 1e3c9c804fec
Create Date: 2025-01-06 12:17:49.935022+00:00

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "a80132007436"
down_revision = "1e3c9c804fec"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"file_meta_data",
sa.Column(
"ref_count", sa.Integer(), server_default=sa.text("0"), nullable=False
),
)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("file_meta_data", "ref_count")
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,11 @@
doc="SHA256 checksum of the file content",
index=True,
),
sa.Column(
"ref_count",
sa.Integer(),
nullable=False,
server_default=sa.text("0"),
doc="Number of references to the file",
),
)
1 change: 1 addition & 0 deletions services/storage/src/simcore_service_storage/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class FileMetaDataAtDB(BaseModel):
upload_expires_at: datetime.datetime | None = None
is_directory: bool
sha256_checksum: SHA256Str | None = None
ref_count: int = 0

model_config = ConfigDict(from_attributes=True, extra="forbid")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# NOTE: MD: I intentionally didn't include the workbench. There is a special interface
# for the workbench, and at some point, this column should be removed from the table.
# The same holds true for access_rights/ui/classifiers/quality, but we have decided to proceed step by step.
# The same holds true for ui/classifiers/quality, but we have decided to proceed step by step.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

access_rights migrated already

_SELECTION_PROJECT_DB_ARGS = [ # noqa: RUF012
projects.c.id,
projects.c.type,
Expand Down
Loading