Switch to unified view

a/scripts/migrate_project_database.py b/scripts/migrate_project_database.py
...
...
55
                    MONGO_RESTORE, host, target_db, dirname, project.database))
55
                    MONGO_RESTORE, host, target_db, dirname, project.database))
56
        database = project.database
56
        database = project.database
57
        for p in M.Project.query.find(dict(database=database)):
57
        for p in M.Project.query.find(dict(database=database)):
58
            p.database = ''
58
            p.database = ''
59
            p.database_uri = M.Project.default_database_uri(pname)
59
            p.database_uri = M.Project.default_database_uri(pname)
60
        project.ensure_project_indexes()
61
        session(project).flush()
60
        session(project).flush()
62
        if not skip:
61
        if not skip:
63
            conn.drop_database(database)
62
            conn.drop_database(database)
64
    finally:
63
    finally:
65
        if os.path.exists(dirname):
64
        if os.path.exists(dirname):