@@ -0,0 +1,791 @@
+#!/usr/bin/env python%0A%0Aimport os%0Aimport sys%0A%0Afrom app.models import db%0A%0Afrom alembic import command%0Afrom alembic.config import Config%0A%0Adef main():%0A%0A    if not os.path.exists('alembic/versions'):%0A        os.mkdir('alembic/versions')%0A%0A    force = True if len(sys.argv) %3E 1 and sys.argv%5B1%5D == '--force' else False%0A    if force or raw_input('Really drop and recreate all tables? (y/N)') == 'y':%0A        db.drop_all()%0A        db.session.execute('DROP TABLE IF EXISTS alembic_version')%0A        db.session.commit()%0A        db.create_all()%0A        print('Created all tables.')%0A        alembic_cfg = Config('alembic.ini')%0A        command.stamp(alembic_cfg, 'head')%0A        print('Configured alembic.')%0A    else:%0A        print('Exiting.')%0A    return 0%0A%0A%0Aif __name__ == '__main__':%0A    sys.exit(main())

add setup database script