def convert():
    create_app()

    print("Replacing content")

    for c in Content.select():
        c.path = c.path.replace("/home/service/kolenka-backend/",
                                "/home/service/kolenka-beta-backend/")
        print("New path " + c.path)
        c.save()
def migration_v3(db, migrator: SchemaMigrator):
    import magic

    from src.model.models import Content

    with db.atomic():
        migrate(
            migrator.add_column("content", "mime", CharField(default="")),
            migrator.add_column("content", "size", BigIntegerField(default=0)),
        )
    query = Content.select()

    for c in query:
        c.mime = magic.from_file(c.path, mime=True)
        c.size = os.stat(c.path).st_size
        c.save()