Source

django-petition / petition / migrations / 0002_auto__add_unique_signature_email__add_unique_signature_first_name_last.py

Full commit
# -*- 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 unique constraint on 'Signature', fields ['email']
        db.create_unique('petition_signature', ['email'])

        # Adding unique constraint on 'Signature', fields ['first_name', 'last_name']
        db.create_unique('petition_signature', ['first_name', 'last_name'])


    def backwards(self, orm):
        # Removing unique constraint on 'Signature', fields ['first_name', 'last_name']
        db.delete_unique('petition_signature', ['first_name', 'last_name'])

        # Removing unique constraint on 'Signature', fields ['email']
        db.delete_unique('petition_signature', ['email'])


    models = {
        'petition.signature': {
            'Meta': {'unique_together': "(('first_name', 'last_name'),)", 'object_name': 'Signature'},
            'country': ('petition.fields.CountryField', [], {'default': "'US'", 'max_length': '2'}),
            'date_signed': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
            'email': ('django.db.models.fields.EmailField', [], {'unique': 'True', 'max_length': '75'}),
            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '60'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '60'}),
            'state': ('django.db.models.fields.CharField', [], {'max_length': '40'})
        }
    }

    complete_apps = ['petition']