text: # Crichton, Admirable Source Configuration Management
  # Copyright 2012 British Broadcasting Corporation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  #  you may not use this file except in compliance with the License.
  #  You may obtain a copy of the License at
  #
  #      http://www.apache.org/licenses/LICENSE-2.0
  #
  #  Unless required by applicable law or agreed to in writing, software
  #  distributed under the License is distributed on an "AS IS" BASIS,
  #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  #  See the License for the specific language governing permissions and
  #  limitations under the License.
  #
  #
  # encoding: utf-8
  import datetime
  from south.db import db
  from south.v2 import SchemaMigration
  from django.db import models
  
  class Migration(SchemaMigration):
  
      def forwards(self, orm):
          
          # Adding model 'PackageInstallation'
          db.create_table('system_packageinstallation', (
              ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
              ('package', self.gf('django.db.models.fields.related.ForeignKey')(related_name='installations', to=orm['package.Package'])),
              ('node', self.gf('django.db.models.fields.related.ForeignKey')(related_name='package_installations', to=orm['system.Node'])),
              ('first_seen', self.gf('django.db.models.fields.DateTimeField')(db_index=True)),
              ('not_seen', self.gf('django.db.models.fields.DateTimeField')(db_index=True, null=True, blank=True)),
          ))
          db.send_create_signal('system', ['PackageInstallation'])
  
          # Adding unique constraint on 'PackageInstallation', fields ['node', 'package', 'not_seen']
          db.create_unique('system_packageinstallation', ['node_id', 'package_id', 'not_seen'])
  
  
      def backwards(self, orm):
          
          # Removing unique constraint on 'PackageInstallation', fields ['node', 'package', 'not_seen']
          db.delete_unique('system_packageinstallation', ['node_id', 'package_id', 'not_seen'])
  
          # Deleting model 'PackageInstallation'
          db.delete_table('system_packageinstallation')
  
  
      models = {
          'auth.group': {
              'Meta': {'object_name': 'Group'},
              'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
              'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
          },
          'auth.permission': {
              'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
              'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
              'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
              'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
          },
          'auth.user': {
              'Meta': {'object_name': 'User'},
              'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
              'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
              'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
              'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
              'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
              'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
              'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
              'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
              'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
              'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
          },
          'contenttypes.contenttype': {
              'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
              'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
              'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
              'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
          },
          'issue.issue': {
              'Meta': {'ordering': "('name',)", 'unique_together': "(('name', 'project'),)", 'object_name': 'Issue'},
              'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'name': ('django.db.models.fields.SlugField', [], {'max_length': '128', 'db_index': 'True'}),
              'project': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'issues'", 'to': "orm['issue.IssueTrackerProject']"}),
              'summary': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'})
          },
          'issue.issuetracker': {
              'Meta': {'ordering': "('name',)", 'object_name': 'IssueTracker'},
              'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'display_name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
              'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'issue_url_pattern': ('django.db.models.fields.URLField', [], {'max_length': '255', 'blank': 'True'}),
              'name': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}),
              'tracker_type': ('django.db.models.fields.CharField', [], {'default': "'jira'", 'max_length': '12'}),
              'url': ('django.db.models.fields.URLField', [], {'max_length': '255', 'blank': 'True'})
          },
          'issue.issuetrackerproject': {
              'Meta': {'ordering': "('name',)", 'unique_together': "(('name', 'issue_tracker'),)", 'object_name': 'IssueTrackerProject'},
              'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'display_name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
              'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'issue_tracker': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'projects'", 'to': "orm['issue.IssueTracker']"}),
              'name': ('django.db.models.fields.SlugField', [], {'max_length': '128', 'db_index': 'True'})
          },
          'package.package': {
              'Meta': {'ordering': "('name',)", 'unique_together': "(('name', 'version'),)", 'object_name': 'Package'},
              'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
              'version': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['package.Version']"})
          },
          'package.version': {
              'Meta': {'ordering': "('major', 'minor', 'micro', 'revision')", 'object_name': 'Version'},
              'build': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
              'major': ('django.db.models.fields.IntegerField', [], {}),
              'micro': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
              'minor': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
              'name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'primary_key': 'True'}),
              'revision': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
              'rpm_release': ('django.db.models.fields.CharField', [], {'max_length': '48', 'null': 'True', 'blank': 'True'}),
              'rpm_version': ('django.db.models.fields.CharField', [], {'max_length': '48', 'null': 'True', 'blank': 'True'}),
              'status': ('django.db.models.fields.CharField', [], {'default': "'release'", 'max_length': '16'})
          },
          'prodmgmt.application': {
              'Meta': {'ordering': "('name',)", 'object_name': 'Application'},
              'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'display_name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
              'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
              'product': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'applications'", 'to': "orm['prodmgmt.Product']"})
          },
          'prodmgmt.person': {
              'Meta': {'ordering': "('username',)", 'object_name': 'Person'},
              'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'distinguished_name': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}),
              'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
              'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
              'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
              'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
          },
          'prodmgmt.product': {
              'Meta': {'ordering': "('name',)", 'object_name': 'Product'},
              'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'display_name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
              'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'name': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}),
              'owner': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'owned_products'", 'to': "orm['prodmgmt.Person']"}),
              'pipeline_issue': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['issue.Issue']"})
          },
          'system.environment': {
              'Meta': {'ordering': "('name',)", 'object_name': 'Environment'},
              'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'})
          },
          'system.environmentauditlogentry': {
              'Meta': {'ordering': "('-action_date',)", 'object_name': 'EnvironmentAuditLogEntry'},
              'action_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
              'action_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'action_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
              'action_user': ('audit_log.models.fields.LastUserField', [], {'related_name': "'_environment_audit_log_entry'"}),
              'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'blank': 'True'}),
              'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'})
          },
          'system.internetaddress': {
              'Meta': {'object_name': 'InternetAddress'},
              'address': ('django.db.models.fields.CharField', [], {'max_length': '45', 'primary_key': 'True'})
          },
          'system.node': {
              'Meta': {'ordering': "('name',)", 'object_name': 'Node'},
              'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'environment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['system.Environment']"}),
              'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'is_virtual': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'})
          },
          'system.nodeaddress': {
              'Meta': {'unique_together': "(('node', 'address'),)", 'object_name': 'NodeAddress'},
              'address': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'nodes'", 'to': "orm['system.InternetAddress']"}),
              'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'node': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'addresses'", 'to': "orm['system.Node']"})
          },
          'system.nodeaddressauditlogentry': {
              'Meta': {'ordering': "('-action_date',)", 'object_name': 'NodeAddressAuditLogEntry'},
              'action_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
              'action_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'action_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
              'action_user': ('audit_log.models.fields.LastUserField', [], {'related_name': "'_nodeaddress_audit_log_entry'"}),
              'address': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'_auditlog_nodes'", 'to': "orm['system.InternetAddress']"}),
              'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'blank': 'True'}),
              'node': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'_auditlog_addresses'", 'to': "orm['system.Node']"})
          },
          'system.nodeauditlogentry': {
              'Meta': {'ordering': "('-action_date',)", 'object_name': 'NodeAuditLogEntry'},
              'action_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
              'action_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'action_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
              'action_user': ('audit_log.models.fields.LastUserField', [], {'related_name': "'_node_audit_log_entry'"}),
              'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'environment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['system.Environment']"}),
              'id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'blank': 'True'}),
              'is_virtual': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'})
          },
          'system.packageinstallation': {
              'Meta': {'unique_together': "(('node', 'package', 'not_seen'),)", 'object_name': 'PackageInstallation'},
              'first_seen': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
              'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'node': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'package_installations'", 'to': "orm['system.Node']"}),
              'not_seen': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
              'package': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'installations'", 'to': "orm['package.Package']"})
          },
          'system.pool': {
              'Meta': {'ordering': "('name',)", 'object_name': 'Pool'},
              'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'environment': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'pools'", 'to': "orm['system.Environment']"}),
              'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'name': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}),
              'role': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'pools'", 'to': "orm['system.Role']"})
          },
          'system.poolauditlogentry': {
              'Meta': {'ordering': "('-action_date',)", 'object_name': 'PoolAuditLogEntry'},
              'action_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
              'action_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'action_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
              'action_user': ('audit_log.models.fields.LastUserField', [], {'related_name': "'_pool_audit_log_entry'"}),
              'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'environment': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'_auditlog_pools'", 'to': "orm['system.Environment']"}),
              'id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'blank': 'True'}),
              'name': ('django.db.models.fields.SlugField', [], {'max_length': '128', 'db_index': 'True'}),
              'role': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'_auditlog_pools'", 'to': "orm['system.Role']"})
          },
          'system.poolmembership': {
              'Meta': {'ordering': "('pool', 'node')", 'unique_together': "(('node', 'pool'),)", 'object_name': 'PoolMembership'},
              'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'node': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'pool_memberships'", 'to': "orm['system.Node']"}),
              'pool': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'members'", 'to': "orm['system.Pool']"})
          },
          'system.poolmembershipauditlogentry': {
              'Meta': {'ordering': "('-action_date',)", 'object_name': 'PoolMembershipAuditLogEntry'},
              'action_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
              'action_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'action_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
              'action_user': ('audit_log.models.fields.LastUserField', [], {'related_name': "'_poolmembership_audit_log_entry'"}),
              'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'blank': 'True'}),
              'node': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'_auditlog_pool_memberships'", 'to': "orm['system.Node']"}),
              'pool': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'_auditlog_members'", 'to': "orm['system.Pool']"})
          },
          'system.role': {
              'Meta': {'ordering': "('name',)", 'object_name': 'Role'},
              'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'name': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'})
          },
          'system.roleauditlogentry': {
              'Meta': {'ordering': "('-action_date',)", 'object_name': 'RoleAuditLogEntry'},
              'action_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
              'action_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'action_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
              'action_user': ('audit_log.models.fields.LastUserField', [], {'related_name': "'_role_audit_log_entry'"}),
              'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'blank': 'True'}),
              'name': ('django.db.models.fields.SlugField', [], {'max_length': '128', 'db_index': 'True'})
          },
          'system.rolemembership': {
              'Meta': {'unique_together': "(('role', 'application'),)", 'object_name': 'RoleMembership'},
              'application': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'roles'", 'to': "orm['prodmgmt.Application']"}),
              'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'role': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'applications'", 'to': "orm['system.Role']"})
          },
          'system.rolemembershipauditlogentry': {
              'Meta': {'ordering': "('-action_date',)", 'object_name': 'RoleMembershipAuditLogEntry'},
              'action_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
              'action_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
              'action_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
              'action_user': ('audit_log.models.fields.LastUserField', [], {'related_name': "'_rolemembership_audit_log_entry'"}),
              'application': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'_auditlog_roles'", 'to': "orm['prodmgmt.Application']"}),
              'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
              'id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'blank': 'True'}),
              'role': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'_auditlog_applications'", 'to': "orm['system.Role']"})
          },
          'system.crichtonstatus': {
              'Meta': {'object_name': 'crichtonStatus'},
              'id': ('django.db.models.fields.IntegerField', [], {'primary_key': 'True'}),
              'last_indexhudson_success': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(1970, 1, 1, 0, 0)'}),
              'last_indexjira_success': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(1970, 1, 1, 0, 0)'}),
              'last_indexrepo_success': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(1970, 1, 1, 0, 0)'}),
              'last_indexzenoss_success': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(1970, 1, 1, 0, 0)'})
          }
      }
  
      complete_apps = ['system']
  