# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models


class Migration(SchemaMigration):

    depends_on = (
        ("reverse_dns", "0001_initial"),
    )

    def forwards(self, orm):
        # Adding field 'IPSubnet.delegate_reverse_dns'
        db.add_column(u'resources_ipsubnet', 'delegate_reverse_dns',
                      self.gf('django.db.models.fields.BooleanField')(default=False),
                      keep_default=False)

        # Adding M2M table for field name_server on 'IPSubnet'
        m2m_table_name = db.shorten_name(u'resources_ipsubnet_name_server')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('ipsubnet', models.ForeignKey(orm[u'resources.ipsubnet'], null=False)),
            ('nameserver', models.ForeignKey(orm[u'reverse_dns.nameserver'], null=False))
        ))
        db.create_unique(m2m_table_name, ['ipsubnet_id', 'nameserver_id'])


    def backwards(self, orm):
        # Deleting field 'IPSubnet.delegate_reverse_dns'
        db.delete_column(u'resources_ipsubnet', 'delegate_reverse_dns')

        # Removing M2M table for field name_server on 'IPSubnet'
        db.delete_table(db.shorten_name(u'resources_ipsubnet_name_server'))


    models = {
        u'members.member': {
            'Meta': {'object_name': 'Member'},
            'address': ('django.db.models.fields.TextField', [], {}),
            'city': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
            'country': ('django.db.models.fields.CharField', [], {'default': "'France'", 'max_length': '200'}),
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '254'}),
            'entry_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.date.today'}),
            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
            'home_phone_number': ('django.db.models.fields.CharField', [], {'max_length': '25', 'blank': 'True'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
            'ldap_cn': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
            'mobile_phone_number': ('django.db.models.fields.CharField', [], {'max_length': '25', 'blank': 'True'}),
            'organization_name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
            'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '15'}),
            'resign_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
            'status': ('django.db.models.fields.CharField', [], {'default': "'non_adherent'", 'max_length': '50'}),
            'type': ('django.db.models.fields.CharField', [], {'default': "'personne_physique'", 'max_length': '20'})
        },
        u'offers.offer': {
            'Meta': {'object_name': 'Offer'},
            'billing_period': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'initial_fees': ('django.db.models.fields.DecimalField', [], {'max_digits': '5', 'decimal_places': '2'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'period_fees': ('django.db.models.fields.DecimalField', [], {'max_digits': '5', 'decimal_places': '2'}),
            'service': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['offers.Service']"})
        },
        u'offers.offersubscription': {
            'Meta': {'object_name': 'OfferSubscription'},
            'commitment': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'member': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['members.Member']"}),
            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['offers.Offer']"}),
            'resign_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
            'subscription_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.date.today'})
        },
        u'offers.service': {
            'Meta': {'object_name': 'Service'},
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'})
        },
        u'resources.ippool': {
            'Meta': {'object_name': 'IPPool'},
            'default_subnetsize': ('django.db.models.fields.PositiveSmallIntegerField', [], {}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'inet': ('netfields.fields.CidrAddressField', [], {'max_length': '43'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'})
        },
        u'resources.ipsubnet': {
            'Meta': {'object_name': 'IPSubnet'},
            'delegate_reverse_dns': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'inet': ('netfields.fields.CidrAddressField', [], {'max_length': '43', 'blank': 'True'}),
            'ip_pool': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['resources.IPPool']"}),
            'name_server': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['reverse_dns.NameServer']", 'symmetrical': 'False'}),
            'offer_subscription': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ip_subnet'", 'to': u"orm['offers.OfferSubscription']"})
        },
        u'reverse_dns.nameserver': {
            'Meta': {'object_name': 'NameServer'},
            'description': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'dns_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
        }
    }

    complete_apps = ['resources']