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

migration: drop uploading column from imagestorage (PROJQUAY-1899) #767

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions data/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,6 @@ class ImageStorage(BaseModel):
uuid = CharField(default=uuid_generator, index=True, unique=True)
image_size = BigIntegerField(null=True)
uncompressed_size = BigIntegerField(null=True)
uploading = BooleanField(default=True, null=True)
cas_path = BooleanField(default=True)
content_checksum = CharField(null=True, index=True)

Expand All @@ -1089,7 +1088,6 @@ class ImageStorageSignature(BaseModel):
storage = ForeignKeyField(ImageStorage)
kind = ForeignKeyField(ImageStorageSignatureKind)
signature = TextField(null=True)
uploading = BooleanField(default=True, null=True)

class Meta:
database = db
Expand Down
16 changes: 16 additions & 0 deletions data/migrations/dba_operator/fdc4231fbcc1-databasemigration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

---
apiVersion: dbaoperator.app-sre.redhat.com/v1alpha1
kind: DatabaseMigration
metadata:
name: fdc4231fbcc1
spec:
migrationContainerSpec:
command:
- /quay-registry/quay-entrypoint.sh
- migrate
- fdc4231fbcc1
image: quay.io/quay/quay
name: fdc4231fbcc1
previous: 88e64904d000
schemaHints: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""Drop uploading column from ImageStorage

Revision ID: fdc4231fbcc1
Revises: 88e64904d000
Create Date: 2021-04-19 13:52:11.840254

"""

# revision identifiers, used by Alembic.
revision = "fdc4231fbcc1"
down_revision = "88e64904d000"

import sqlalchemy as sa


def upgrade(op, tables, tester):
op.drop_column("imagestorage", "uploading")
op.drop_column("imagestoragesignature", "uploading")


def downgrade(op, tables, tester):
op.add_column(
"imagestorage",
sa.Column(
"checksum", sa.Boolean(), nullable=False, server_default=sa.sql.expression.false()
),
)
op.add_column(
"imagestoragesignature",
sa.Column(
"checksum", sa.Boolean(), nullable=False, server_default=sa.sql.expression.false()
),
)
5 changes: 1 addition & 4 deletions data/registry_model/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,9 +542,7 @@ def estimated_size(self, estimate_multiplier):
return (self.layer_info.compressed_size or 0) * estimate_multiplier


class Blob(
datatype("Blob", ["uuid", "digest", "compressed_size", "uncompressed_size", "uploading"])
):
class Blob(datatype("Blob", ["uuid", "digest", "compressed_size", "uncompressed_size"])):
"""
Blob represents a content-addressable piece of storage.
"""
Expand All @@ -561,7 +559,6 @@ def for_image_storage(cls, image_storage, storage_path, placements=None):
digest=image_storage.content_checksum,
compressed_size=image_storage.image_size,
uncompressed_size=image_storage.uncompressed_size,
uploading=image_storage.uploading,
)

@property
Expand Down
Binary file modified test/data/test.db
Binary file not shown.