@db_cli.command('delete')
@click.option('--test-db', '-t', default=False, is_flag=True, help=f'Deletes the database {TestingConfig.POSTGRES_DB!r}.')
@pass_psql_admin_connection
@dev_only
def delete_database(conn: connection, test_db: bool):
    'Delete the database.'
    if test_db:
        database = TestingConfig.POSTGRES_DB
    else:
        database = current_app.config['POSTGRES_DB']
    cursor = conn.cursor()
    cursor.execute('ROLLBACK')
    if (database != TestingConfig.POSTGRES_DB):
        click.echo(f'Are you sure you want to delete database {database!r}?')
        click.echo((("Type in the database name '" + click.style(database, fg='red')) + "' to confirm"))
        confirmation = click.prompt('Database name')
        if (database != confirmation):
            click.echo('The input does not match. The database will not be deleted.')
            return None
    try:
        cursor.execute(f'DROP DATABASE {database};')
    except psycopg2.errors.lookup('3D000'):
        click.echo(f'Database {database!r} does not exist.')
        cursor.execute('ROLLBACK')
    else:
        click.echo(f'Database {database!r} was deleted.')
Delete the database.
@db_cli.command('delete')
@click.option('--test-db', '-t', default=False, is_flag=True, help=f'Deletes the database {TestingConfig.POSTGRES_DB!r}.')
@pass_psql_admin_connection
@dev_only
def delete_database(conn: connection, test_db: bool):
    
    if test_db:
        database = TestingConfig.POSTGRES_DB
    else:
        database = current_app.config['POSTGRES_DB']
    cursor = conn.cursor()
    cursor.execute('ROLLBACK')
    if (database != TestingConfig.POSTGRES_DB):
        click.echo(f'Are you sure you want to delete database {database!r}?')
        click.echo((("Type in the database name '" + click.style(database, fg='red')) + "' to confirm"))
        confirmation = click.prompt('Database name')
        if (database != confirmation):
            click.echo('The input does not match. The database will not be deleted.')
            return None
    try:
        cursor.execute(f'DROP DATABASE {database};')
    except psycopg2.errors.lookup('3D000'):
        click.echo(f'Database {database!r} does not exist.')
        cursor.execute('ROLLBACK')
    else:
        click.echo(f'Database {database!r} was deleted.')