def downgrade() -> None:
    for (pkgid, build, pkgtype) in get_bind().execute(
            sa.select(
                [package.c.id,
                 package.c.build_id,
                 package.c.pkgtype]
            )):
        db_package = Package()
        db_package.id = pkgid
        db_package.build_id = build
        db_package.pkgtype = pkgtype
        ext_len = len(pkgtype) + 1
        lobpath = db_package.get_lob_path("package")
        if lobpath.endswith(".{}".format(pkgtype)) and os.path.isfile(lobpath):
            os.rename(lobpath, lobpath[:-ext_len])
Пример #2
0
def downgrade() -> None:
    for (pkgid, build, pkgtype) in get_bind().execute(
            sa.select(
                [package.c.id,
                 package.c.build_id,
                 package.c.pkgtype]
            )):
        db_package = Package()
        db_package.id = pkgid
        db_package.build_id = build
        db_package.pkgtype = pkgtype
        ext_len = len(pkgtype) + 1
        # Package inherits get_lob_path() from GenericTable.
        lobpath = db_package.get_lob_path("package")  # pylint: disable=no-member
        if lobpath.endswith(".{}".format(pkgtype)) and os.path.isfile(lobpath):
            os.rename(lobpath, lobpath[:-ext_len])