def recreate_db(): """Recreates a database.""" #raise click.Abort() db.reflect() db.drop_all() db.create_all() db.session.commit()
def recreate_db(): """ Recreates the database """ db.reflect() db.drop_all() db.create_all() db.session.commit()
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') ]
def recreate_db(): db.reflect() db.drop_all() db.create_all() db.session.commit()
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()