Add PackageUpdateConfig.auto_created

This commit is contained in:
rubenwardy 2021-01-29 23:18:37 +00:00
parent c6d39fcba3
commit 29adccb6d1
4 changed files with 30 additions and 0 deletions

@ -179,6 +179,7 @@ def admin_page():
added = 0
for pkg in Package.query.filter(Package.repo != None, Package.releases.any(), Package.update_config == None).all():
pkg.update_config = PackageUpdateConfig()
pkg.update_config.auto_created = True
release: PackageRelease = pkg.releases.first()
if release and release.commit_hash:

@ -301,6 +301,8 @@ def update_config(package):
if last_release and last_release.commit_hash:
package.update_config.last_commit = last_release.commit_hash
package.update_config.auto_created = False
db.session.commit()
if package.update_config.last_commit is None:

@ -965,5 +965,8 @@ class PackageUpdateConfig(db.Model):
make_release = db.Column(db.Boolean, nullable=False, default=False)
# Was this made using Add Update Configs in Admin?
auto_created = db.Column(db.Boolean, nullable=False, default=False)
def set_outdated(self):
self.outdated_at = datetime.datetime.utcnow()

@ -0,0 +1,24 @@
"""empty message
Revision ID: 96811eb565c1
Revises: a337bcc165c0
Create Date: 2021-01-29 23:14:37.806520
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '96811eb565c1'
down_revision = 'a337bcc165c0'
branch_labels = None
depends_on = None
def upgrade():
op.add_column('package_update_config', sa.Column('auto_created', sa.Boolean(), nullable=False, server_default="false"))
def downgrade():
op.drop_column('package_update_config', 'auto_created')