Ejemplo n.º 1
0
def recreate_db():
    """Recreates a database."""
    #raise click.Abort()
    db.reflect()
    db.drop_all()
    db.create_all()
    db.session.commit()
Ejemplo n.º 2
0
def recreate_db():
    """
    Recreates the database
    """
    db.reflect()
    db.drop_all()
    db.create_all()
    db.session.commit()
Ejemplo n.º 3
0
from datetime import timedelta as td

from project import db
from project.models import Game, Country, Track, Player, CarClass, Car,\
                           Weather, Split, Turn, Event, EventPlayer, Stage, StageRanking

print('Creating new tables...', end=' ')

# Drop all existing database tables
db.reflect()
db.drop_all()

# Create new tables
db.create_all()

print('Done!')
print('Adding DiRT Rally...', end=' ')

exec(open('db_data/db_add_dirt_rally.py').read())

print('Done!')
print('Creating an event...', end=' ')

# Create players
players = [
    Player(name='Filip'),
    Player(name='Michał'),
    Player(name='Radek'),
    Player(name='Dominik')
]
Ejemplo n.º 4
0
def recreate_db():
    db.reflect()
    db.drop_all()
    db.create_all()
    db.session.commit()
Ejemplo n.º 5
0
def drop_db():
    """Drops the db tables."""
    db.reflect()
    db.drop_all()
def recreate_db():
    """Delete all the data in the database and recreate all tables."""
    db.reflect()
    db.drop_all()
    db.create_all()
    db.session.commit()