storage: add UploadSessions columns for server-proxied upload metadata
The server-proxied upload flow (replaces presign-PUT) stores the file-level metadata directly on the UploadSessions row at session creation, so step 2 (PUT bytes) can build the StorageObjects row without re-sending metadata through a separate CompleteUploadRequest. New columns on upload_sessions: file_name VARCHAR(255) NOT NULL DEFAULT '' usage_type VARCHAR(32) NOT NULL DEFAULT 'working_copy' visibility VARCHAR(16) NOT NULL DEFAULT 'private' is_immutable TINYINT(1) NOT NULL DEFAULT 0 The SQLAlchemy model already declares these columns; this migration applies the schema change to MySQL. Migration: c3d4e5f6a7b8_upload_session_object_metadata.py (chains off a2b3c4d5e6f7)
This commit is contained in:
@@ -0,0 +1,73 @@
|
|||||||
|
"""add object metadata columns to upload_sessions
|
||||||
|
|
||||||
|
Stores file_name / usage_type / visibility / is_immutable at session creation
|
||||||
|
so the server-proxied PUT step can build the StorageObjects row without
|
||||||
|
re-sending them. Replaces the old CompleteUploadRequest payload that bridged
|
||||||
|
the presign-PUT and head()-validate steps.
|
||||||
|
|
||||||
|
Revision ID: c3d4e5f6a7b8
|
||||||
|
Revises: a2b3c4d5e6f7
|
||||||
|
Create Date: 2026-08-05 12:00:00
|
||||||
|
"""
|
||||||
|
|
||||||
|
from collections.abc import Sequence
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
revision: str = "c3d4e5f6a7b8"
|
||||||
|
down_revision: str | Sequence[str] | None = "a2b3c4d5e6f7"
|
||||||
|
branch_labels: str | Sequence[str] | None = None
|
||||||
|
depends_on: str | Sequence[str] | None = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
op.add_column(
|
||||||
|
"upload_sessions",
|
||||||
|
sa.Column(
|
||||||
|
"file_name",
|
||||||
|
sa.String(length=255),
|
||||||
|
nullable=False,
|
||||||
|
server_default="",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
op.add_column(
|
||||||
|
"upload_sessions",
|
||||||
|
sa.Column(
|
||||||
|
"usage_type",
|
||||||
|
sa.String(length=32),
|
||||||
|
nullable=False,
|
||||||
|
server_default="working_copy",
|
||||||
|
comment=(
|
||||||
|
"data_resource/version_artifact/snapshot/run_log/run_result/"
|
||||||
|
"working_copy/public_script"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
op.add_column(
|
||||||
|
"upload_sessions",
|
||||||
|
sa.Column(
|
||||||
|
"visibility",
|
||||||
|
sa.String(length=16),
|
||||||
|
nullable=False,
|
||||||
|
server_default="private",
|
||||||
|
comment="private/workspace/public",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
op.add_column(
|
||||||
|
"upload_sessions",
|
||||||
|
sa.Column(
|
||||||
|
"is_immutable",
|
||||||
|
sa.TINYINT(1),
|
||||||
|
nullable=False,
|
||||||
|
server_default="0",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
op.drop_column("upload_sessions", "is_immutable")
|
||||||
|
op.drop_column("upload_sessions", "visibility")
|
||||||
|
op.drop_column("upload_sessions", "usage_type")
|
||||||
|
op.drop_column("upload_sessions", "file_name")
|
||||||
Reference in New Issue
Block a user