mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-11-09 05:24:49 +09:00
Opt-in to_dict over __table__.columns: auto-isoformat datetimes, *_encrypted always dropped, __serialize_exclude__ for redacted columns, serialize_extra() for computed fields (named to dodge ServerMetrics' literal 'extra' column). 20 purely-mechanical to_dicts across 15 files convert; genuinely custom shapes keep their hand-written methods (plan 75 §F's ruling stands). Field selection stays api/_query.py's job. Gate: key-for-key parity against the pre-conversion key sets frozen from git HEAD (only the Timestamp pair may be additive). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
25 lines
1.1 KiB
Python
25 lines
1.1 KiB
Python
from datetime import datetime
|
|
from app import db
|
|
from app.models.mixins import SerializableMixin
|
|
|
|
|
|
class ImageUpdateCheck(SerializableMixin, db.Model):
|
|
"""Result of comparing an application's running image digest against the
|
|
current digest for the same tag in its registry."""
|
|
__tablename__ = 'image_update_checks'
|
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
application_id = db.Column(db.Integer, db.ForeignKey('applications.id'), nullable=False, index=True)
|
|
image_ref = db.Column(db.String(500), nullable=False)
|
|
current_digest = db.Column(db.String(128)) # sha256:... running locally
|
|
latest_digest = db.Column(db.String(128)) # sha256:... currently in the registry
|
|
update_available = db.Column(db.Boolean, default=False, nullable=False)
|
|
status = db.Column(db.String(20), default='pending') # pending, completed, failed
|
|
error_message = db.Column(db.Text)
|
|
checked_at = db.Column(db.DateTime, default=datetime.utcnow)
|
|
|
|
application = db.relationship('Application', backref=db.backref(
|
|
'image_update_checks', lazy='dynamic',
|
|
order_by='ImageUpdateCheck.checked_at.desc()'))
|
|
|