#!/usr/bin/env python

import settings
import os

def get_app_name(app_str):
    if '.' in app_str:
        return app_str.rsplit('.', 1)[-1]
    return app_str

apps = [get_app_name(app) for app in settings.INSTALLED_APPS]
for app in apps:
    os.system('python manage.py sqlall %s' % app)