Apply all migrations in a chronological order

def apply_migrations(engine, connection, path):
    """ Apply all migrations in a chronological order """

    # Get migrations applied
    migrations_applied = get_migrations_applied(engine, connection)
    # print(migrationsApplied)

    # Get migrations folder
    for file in get_migrations_files(path):
        # Set vars
        basename = os.path.basename(os.path.dirname(file))

        # Skip migrations if they are already applied
        if is_applied(migrations_applied, basename):
            continue

        # Get migration source
        source = get_migration_source(file)
        # print (source);

        # Run migration
        run_migration(connection, source, engine)

        # Save migration
        save_migration(connection, basename)

        # Log
        print('   -> Migration `%s` applied' % (basename))

    # Log
    print(' * Migrations applied')

    return True