示例#1
0
def drop_and_create_db(verbose=False):
    """
    Drops database and creates a new one
    """
    if not verbose:
        db.engine.echo = False
    db.reflect()
    db.drop_all()
    db.create_all()
    return 0
示例#2
0
文件: manage.py 项目: batusayici/noi2
def drop_db(verbose=False):
    """
    Drops database
    """
    if verbose:
        db.engine.echo = False
    else:
        db.engine.echo = True

    db.session.commit()
    db.reflect()
    db.drop_all()
    #db.engine.execute("drop schema if exists public cascade;")
    #db.engine.execute("create schema public;")
    #db.create_all()
    return 0
示例#3
0
文件: manage.py 项目: tekd/noi2
def drop_db(verbose=False):
    """
    Drops database
    """
    if verbose:
        db.engine.echo = False
    else:
        db.engine.echo = True

    db.session.commit()
    db.reflect()
    db.drop_all()
    #db.engine.execute("drop schema if exists public cascade;")
    #db.engine.execute("create schema public;")
    #db.create_all()
    return 0
    u.authenticated = True
    db.session.add(u)

    n1 = NodeModel("001", "http://secret-inlet-51780.herokuapp.com/api/", "remoteuser", "abc")
    n1.method = "basic"
    nodeauth1 = AuthModel("http://secret-inlet-51780.herokuapp.com/api/")

    n2 = NodeModel("002", "http://project-c404.rhcloud.com/api/", "node2", "asdfasdf")
    n2.method = "basic"
    nodeauth2 = AuthModel("http://project-c404.rhcloud.com/api/")

    nodeauth3 = AuthModel("https://blooming-earth-94594.herokuapp.com/api/")

    db.session.add(n1)
    db.session.add(n2)
    db.session.add(nodeauth1)
    db.session.add(nodeauth2)
    db.session.add(nodeauth3)

    db.session.commit()
    print("SysAdmin Created email:"+email+" password: default uid: 0")

    print("is admin:", u.admin)
    print("is authenticated:", u.authenticated)

#apparently needs this? http://jrheard.tumblr.com/post/12759432733/dropping-all-tables-on-postgres-using
db.reflect()
db.drop_all()
db.create_all()
makeSysAdmin()
示例#5
0
def reflect_db():
    db.reflect()