old_contents: from pathlib import Path
  import shutil
  
  import click
  
  from housekeeper.store import Store
  
  
  @click.group()
  @click.pass_context
  def delete(context):
      """Delete things in the database."""
      context.obj['store'] = Store(context.obj['database'], context.obj['root'])
  
  
  @delete.command()
  @click.option('-y', '--yes', is_flag=True, help='skip checks')
  @click.argument('bundle_name')
  @click.pass_context
  def bundle(context, yes, bundle_name):
      """Delete the latest bundle version."""
      bundle_obj = context.obj['store'].bundle(bundle_name)
      if bundle_obj is None:
          click.echo(click.style('bundle not found', fg='red'))
          context.abort()
      version_obj = bundle_obj.versions[0]
      if version_obj.included_at:
          question = f"remove bundle version from file system and database: {version_obj.root_dir}"
      else:
          question = f"remove bundle version from database: {version_obj.created_at.date()}"
      if yes or click.confirm(question):
          if version_obj.included_at:
              shutil.rmtree(version_obj.root_dir, ignore_errors=True)
          version_obj.delete()
          context.obj['store'].commit()
          click.echo(f"version deleted: {version_obj.root_dir}")
  
  
  @delete.command('file')
  @click.option('-y', '--yes', is_flag=True, help='skip checks')
  @click.argument('file_id', type=int)
  @click.pass_context
  def file_cmd(context, yes, file_id):
      """Delete a file."""
      file_obj = context.obj['store'].File.get(file_id)
      if file_obj.is_included:
          question = f"remove file from file system and database: {file_obj.full_path}"
      else:
          question = f"remove file from database: {file_obj.full_path}"
      if yes or click.confirm(question):
          if file_obj.is_included and file_obj.full_path.exists():
              file_obj.full_path.unlink()
  
          file_obj.delete()
          context.obj['store'].commit()
          click.echo('file deleted')
  
new_contents: from pathlib import Path
  import shutil
  
  import click
  
  from housekeeper.store import Store
  
  
  @click.group()
  @click.pass_context
  def delete(context):
      """Delete things in the database."""
      context.obj['store'] = Store(context.obj['database'], context.obj['root'])
  
  
  @delete.command()
  @click.option('-y', '--yes', is_flag=True, help='skip checks')
  @click.argument('bundle_name')
  @click.pass_context
  def bundle(context, yes, bundle_name):
      """Delete the latest bundle version."""
      bundle_obj = context.obj['store'].bundle(bundle_name)
      if bundle_obj is None:
          click.echo(click.style('bundle not found', fg='red'))
          context.abort()
      version_obj = bundle_obj.versions[0]
      if version_obj.included_at:
          question = f"remove bundle version from file system and database: {version_obj.root_dir}"
      else:
          question = f"remove bundle version from database: {version_obj.created_at.date()}"
      if yes or click.confirm(question):
          if version_obj.included_at:
              shutil.rmtree(version_obj.root_dir, ignore_errors=True)
          version_obj.delete()
          context.obj['store'].commit()
          click.echo(f"version deleted: {version_obj.root_dir}")
  
  
  @delete.command('file')
  @click.option('-y', '--yes', is_flag=True, help='skip checks')
  @click.argument('file_id', type=int)
  @click.pass_context
  def file_cmd(context, yes, file_id):
      """Delete a file."""
      file_obj = context.obj['store'].File.get(file_id)
      if file_obj.is_included:
          question = f"remove file from file system and database: {file_obj.full_path}"
      else:
          question = f"remove file from database: {file_obj.full_path}"
      if yes or click.confirm(question):
          if file_obj.is_included and Path(file_obj.full_path).exists():
              Path(file_obj.full_path).unlink()
  
          file_obj.delete()
          context.obj['store'].commit()
          click.echo('file deleted')
  
subject: Fix files not deleting