blob: 95b19d3022f6355c50cd25b38c04c22b274ef095 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import click
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
@click.group(context_settings = CONTEXT_SETTINGS)
def cli():
pass
@cli.group()
def db():
"""Database Management"""
pass
@db.command()
def init():
"""Initialize the database, if not done already."""
from .model import create_all
create_all()
@db.command()
@click.confirmation_option(prompt="Are you sure you want to drop the database?")
def drop(force):
"""Completely drop all tables."""
from .model import drop_all
drop_all()
|