mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-03 03:37:28 +01:00
Add PackageUpdateConfig.auto_created
This commit is contained in:
parent
c6d39fcba3
commit
29adccb6d1
@ -179,6 +179,7 @@ def admin_page():
|
|||||||
added = 0
|
added = 0
|
||||||
for pkg in Package.query.filter(Package.repo != None, Package.releases.any(), Package.update_config == None).all():
|
for pkg in Package.query.filter(Package.repo != None, Package.releases.any(), Package.update_config == None).all():
|
||||||
pkg.update_config = PackageUpdateConfig()
|
pkg.update_config = PackageUpdateConfig()
|
||||||
|
pkg.update_config.auto_created = True
|
||||||
|
|
||||||
release: PackageRelease = pkg.releases.first()
|
release: PackageRelease = pkg.releases.first()
|
||||||
if release and release.commit_hash:
|
if release and release.commit_hash:
|
||||||
|
@ -301,6 +301,8 @@ def update_config(package):
|
|||||||
if last_release and last_release.commit_hash:
|
if last_release and last_release.commit_hash:
|
||||||
package.update_config.last_commit = last_release.commit_hash
|
package.update_config.last_commit = last_release.commit_hash
|
||||||
|
|
||||||
|
package.update_config.auto_created = False
|
||||||
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
if package.update_config.last_commit is None:
|
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)
|
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):
|
def set_outdated(self):
|
||||||
self.outdated_at = datetime.datetime.utcnow()
|
self.outdated_at = datetime.datetime.utcnow()
|
||||||
|
24
migrations/versions/96811eb565c1_.py
Normal file
24
migrations/versions/96811eb565c1_.py
Normal file
@ -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')
|
Loading…
Reference in New Issue
Block a user