21 lines
842 B
Python
21 lines
842 B
Python
"""Records of database backups created through the admin panel."""
|
|
|
|
from app.extensions import db
|
|
from datetime import datetime
|
|
|
|
|
|
class BackupRecord(db.Model):
|
|
"""Metadata for a database backup stored on disk."""
|
|
|
|
__tablename__ = 'backup_records'
|
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
filename = db.Column(db.String(255), nullable=False)
|
|
file_path = db.Column(db.String(500), nullable=False)
|
|
size_bytes = db.Column(db.BigInteger, nullable=True)
|
|
backup_type = db.Column(db.String(20), default='manual') # 'manual' or 'auto'
|
|
notes = db.Column(db.Text, nullable=True)
|
|
created_by_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=True)
|
|
created_at = db.Column(db.DateTime, default=datetime.utcnow)
|
|
|
|
creator = db.relationship('User', foreign_keys=[created_by_id], backref='backups') |