def setup_postgres(drop_all=False): # set up postgres logger.info("connecting to postgres") #export POSTGRESQL_URL=postgres://localhost/core_migration #export POSTGRESQL_URL=postgres://localhost/corecopy if "def95794hs4ou7" in app.config["SQLALCHEMY_DATABASE_URI"]: print "\n\nTHIS MAY BE THE PRODUCTION DATABASE!!!" confirm = raw_input( "\nType YES if you are sure you want to run this test:") if not confirm == "YES": print "nevermind, then." exit() if drop_all: print "the postgres database is ", app.config[ "SQLALCHEMY_DATABASE_URI"] confirm = raw_input( "\nType YES if you are sure you want to drop tables:") if not confirm == "YES": print "nevermind, then." exit() try: db.drop_all() except OperationalError, e: #database "database" does not exist print e
def setup_postgres(drop_all=False): # set up postgres logger.info("connecting to postgres") #export POSTGRESQL_URL=postgres://localhost/core_migration #export POSTGRESQL_URL=postgres://localhost/corecopy if "def95794hs4ou7" in app.config["SQLALCHEMY_DATABASE_URI"]: print "\n\nTHIS MAY BE THE PRODUCTION DATABASE!!!" confirm = raw_input("\nType YES if you are sure you want to run this test:") if not confirm=="YES": print "nevermind, then." exit() if drop_all: print "the postgres database is ", app.config["SQLALCHEMY_DATABASE_URI"] confirm = raw_input("\nType YES if you are sure you want to drop tables:") if not confirm=="YES": print "nevermind, then." exit() try: db.drop_all() except OperationalError, e: #database "database" does not exist print e
def main(drop = False): if drop: print "dropping all sqlalchemy tables" db.drop_all() print "creating all sqlalchemy tables" db.create_all()