From f1a5e9bb01bb7fd802e7cf87b4e9dd675e910140 Mon Sep 17 00:00:00 2001 From: Mart Raudsepp Date: Wed, 7 Dec 2016 02:30:06 +0200 Subject: models: Add description and last_sync_ts columns for Package description we will get from package.g.o per-package detailed json, last_sync_ts will be used to record when that detailed json was last pulled, so that we can rate-limit as-needed. If still using sqlite, can DROP TABLE package; and re-create with ./manage.py init or add the columns manually ALTER TABLE package ADD COLUMN description VARCHAR(500); ALTER TABLE package ADD COLUMN last_sync_ts TIMESTAMP NOT NULL; though that NOT NULL vs default on sqlalchemy's side for now might pose an issue, solving of which is an easy exercise for those that care instead of recreating. --- backend/lib/models.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/lib/models.py b/backend/lib/models.py index f842a8a..e06dcf8 100644 --- a/backend/lib/models.py +++ b/backend/lib/models.py @@ -1,3 +1,4 @@ +from datetime import datetime from .. import db @@ -14,6 +15,8 @@ class Package(db.Model): name = db.Column(db.Unicode(128), nullable=False) category_id = db.Column(db.Integer, db.ForeignKey('category.id'), nullable=False) category = db.relationship('Category', backref=db.backref('packages', lazy='dynamic')) + description = db.Column(db.Unicode(500)) + last_sync_ts = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcfromtimestamp(0)) @property def full_name(self): @@ -31,6 +34,7 @@ class PackageVersion(db.Model): def __repr__(self): return "" % (self.package.category.name, self.package.name, self.version) + maintainer_project_membership_rel_table = db.Table('maintainer_project_membership_rel', db.Column('project_id', db.Integer, db.ForeignKey('maintainer.id')), db.Column('maintainer_id', db.Integer, db.ForeignKey('maintainer.id')), -- cgit v1.2.3-65-gdbad