old_contents: from django.db import models
  from django.utils.translation import ugettext as _
  from djblets.util.fields import JSONField
  
  
  class ReviewBotTool(models.Model):
      """Information about a tool installed on a worker."""
      name = models.CharField(max_length=128, blank=False)
      entry_point = models.CharField(max_length=128, blank=False)
      version = models.CharField(max_length=128, blank=False)
      description = models.CharField(max_length=512, default="", blank=True)
      enabled = models.BooleanField(default=True)
      run_automatically = models.BooleanField(
          default=False,
          help_text=_("Run automatically when a review request is updated."))
      allow_run_manually = models.BooleanField(default=False)
      in_last_update = models.BooleanField()
      ship_it = models.BooleanField(
          default=False,
          help_text=_("Ship it! If no issues raised."))
      open_issues = models.BooleanField(default=False)
      comment_unmodified = models.BooleanField(
          default=False,
          verbose_name=_("Comment on unmodified code"))
      tool_options = JSONField()
      tool_settings = JSONField()
  
      def __unicode__(self):
          return "%s - v%s" % (self.name, self.version)
  
      class Meta:
          unique_together = ('entry_point', 'version')
  
new_contents: from django.contrib.auth.models import User
  from django.db import models
  from django.utils.translation import ugettext as _
  
  from djblets.util.fields import JSONField
  from reviewboard.reviews.models import Review
  from reviewboard.scmtools.models import Repository
  from reviewboard.site.models import LocalSite
  
  
  class Tool(models.Model):
      """Information about a tool installed on a worker."""
      name = models.CharField(max_length=128, blank=False)
      entry_point = models.CharField(max_length=128, blank=False)
      version = models.CharField(max_length=128, blank=False)
      description = models.CharField(max_length=512, default="", blank=True)
      enabled = models.BooleanField(default=True)
      in_last_update = models.BooleanField()
      ship_it = models.BooleanField(
          default=False,
          help_text=_("Ship it! If no issues raised."))
      open_issues = models.BooleanField(default=False)
      comment_unmodified = models.BooleanField(
          default=False,
          verbose_name=_("Comment on unmodified code"))
      tool_options = JSONField()
      tool_settings = JSONField()
  
      def __unicode__(self):
          return "%s - v%s" % (self.name, self.version)
  
      class Meta:
          unique_together = ('entry_point', 'version')
  
  
  class ToolProfile(models.Model):
      """A configuration of a tool.
  
      Each Profile may have distinct settings for the associated
      tool, and a set of rules for when the tool will run or be
      allowed to run.
      """
      tool = models.ForeignKey(ReviewBotTool)
      name = models.CharField(max_length=128, blank=False)
      description = models.CharField(max_length=512, default="", blank=True)
      enabled = models.BooleanField(default=True)
  
      auto_repos = models.ManyToManyField(
          Repository,
          help_text=_("Repositories to run on automatically"))
  
      allow_manual = models.BooleanField(default=False)
      allow_manual_submitter = models.BooleanField(default=False)
      allow_manual_group = models.BooleanField(default=False)
  
      ship_it = models.BooleanField(
          default=False,
          help_text=_("Ship it! If no issues raised."))
      open_issues = models.BooleanField(default=False)
      comment_unmodified = models.BooleanField(
          default=False,
          verbose_name=_("Comment on unmodified code"))
      tool_settings = JSONField()
  
      def __unicode__(self):
          return self.name
  
  
  class ManualPermission(models.Model):
      """Manual execution permissions for a user on a local site."""
      user = models.ForeignKey(User)
      local_site = models.ForeignKey(LocalSite)
      allow = models.BooleanField(default=False)
  
  
  class ToolExecution(models.Model):
      """Status of a tool execution"""
      profile = models.ForeignKey(ToolProfile)
      # status = TODO: How to store the status, and what to store.
  
  
  class ToolReview(models.Model):
      """The review generated by a tool execution"""
      data = JSONField()
      posted_review = models.ForeignKey(Review, null=True)
  
subject: Update the data model.