<commit_before># -*- coding: 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 field 'SummaryAttribute.device'
        default_device_pk = orm['h1ds.Device'].objects.get(is_default=True).pk
        db.add_column(u'h1ds_summary_summaryattribute', 'device',
                      self.gf('django.db.models.fields.related.ForeignKey')(default=default_device_pk, to=orm['h1ds.Device'], on_delete=models.PROTECT),
                      keep_default=False)

    def backwards(self, orm):
        # Deleting field 'SummaryAttribute.device'
        db.delete_column(u'h1ds_summary_summaryattribute', 'device_id')

    models = {
        u'h1ds.device': {
            'Meta': {'object_name': 'Device'},
            'description': ('django.db.models.fields.TextField', [], {}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'is_default': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'latest_shot': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': u"orm['h1ds.Shot']"}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'})
        },
        u'h1ds.shot': {
            'Meta': {'object_name': 'Shot'},
            'device': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['h1ds.Device']", 'on_delete': 'models.PROTECT'}),
            'number': ('django.db.models.fields.PositiveIntegerField', [], {'primary_key': 'True'}),
            'timestamp': ('django.db.models.fields.DateTimeField', [], {})
        },
        u'h1ds_summary.summaryattribute': {
            'Meta': {'ordering': "['display_order', 'slug']", 'object_name': 'SummaryAttribute'},
            'description': ('django.db.models.fields.TextField', [], {}),
            'device': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['h1ds.Device']", 'on_delete': 'models.PROTECT'}),<commit_msg>fix h1ds migration exception when in dry run<commit_after># -*- coding: 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 field 'SummaryAttribute.device'
        if not db.dry_run:
            default_device_pk = orm['h1ds.Device'].objects.get(is_default=True).pk
        else:
            default_device_pk = 0
        db.add_column(u'h1ds_summary_summaryattribute', 'device',
                      self.gf('django.db.models.fields.related.ForeignKey')(default=default_device_pk, to=orm['h1ds.Device'], on_delete=models.PROTECT),
                      keep_default=False)

    def backwards(self, orm):
        # Deleting field 'SummaryAttribute.device'
        db.delete_column(u'h1ds_summary_summaryattribute', 'device_id')

    models = {
        u'h1ds.device': {
            'Meta': {'object_name': 'Device'},
            'description': ('django.db.models.fields.TextField', [], {}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'is_default': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'latest_shot': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': u"orm['h1ds.Shot']"}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'})
        },
        u'h1ds.shot': {
            'Meta': {'object_name': 'Shot'},
            'device': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['h1ds.Device']", 'on_delete': 'models.PROTECT'}),
            'number': ('django.db.models.fields.PositiveIntegerField', [], {'primary_key': 'True'}),
            'timestamp': ('django.db.models.fields.DateTimeField', [], {})
        },
        u'h1ds_summary.summaryattribute': {
            'Meta': {'ordering': "['display_order', 'slug']", 'object_name': 'SummaryAttribute'},
            'description': ('django.db.models.fields.TextField', [], {}),
            'device': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['h1ds.Device']", 'on_delete': 'models.PROTECT'}),
{'fraction_non_alphanumeric': 0.19813416259440247, 'fraction_numerical': 0.007552199022656597, 'mean_word_length': 3.154059040590406, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '421291', 'n_tokens_mistral': 1407, 'n_tokens_neox': 1390, 'n_words': 220}