decouple mailbox from domain

This commit is contained in:
Jan Dittberner 2014-05-22 22:57:21 +02:00
parent 618a9b8c11
commit cc7f5247ab
2 changed files with 54 additions and 1 deletions

View file

@ -0,0 +1,54 @@
# -*- coding: utf-8 -*-
# pymode:lint_ignore=E501
from south.db import db
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Mailbox.domain'
db.delete_column(u'managemails_mailbox', 'domain_id')
def backwards(self, orm):
# User chose to not deal with backwards NULL issues for 'Mailbox.domain'
raise RuntimeError("Cannot reverse this migration. 'Mailbox.domain' and its values cannot be restored.")
models = {
u'managemails.mailaddress': {
'Meta': {'unique_together': "(('localpart', 'domain'),)", 'object_name': 'MailAddress'},
'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'domain': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['managemails.MailDomain']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'localpart': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
u'managemails.mailaddressforward': {
'Meta': {'unique_together': "(('mailaddress', 'target'),)", 'object_name': 'MailAddressForward'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'mailaddress': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['managemails.MailAddress']"}),
'target': ('django.db.models.fields.EmailField', [], {'max_length': '254'})
},
u'managemails.mailaddressmailbox': {
'Meta': {'unique_together': "(('mailaddress', 'mailbox'),)", 'object_name': 'MailAddressMailbox'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'mailaddress': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['managemails.MailAddress']"}),
'mailbox': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['managemails.Mailbox']"})
},
u'managemails.mailbox': {
'Meta': {'object_name': 'Mailbox'},
'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'gid': ('django.db.models.fields.PositiveSmallIntegerField', [], {}),
'home': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'uid': ('django.db.models.fields.PositiveSmallIntegerField', [], {}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'})
},
u'managemails.maildomain': {
'Meta': {'object_name': 'MailDomain'},
'domain': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
}
}
complete_apps = ['managemails']

View file

@ -18,7 +18,6 @@ class MailDomain(models.Model):
class Mailbox(models.Model):
username = models.CharField(max_length=128, unique=True)
domain = models.ForeignKey(MailDomain)
password = models.CharField(max_length=255)
home = models.CharField(max_length=255)
uid = models.PositiveSmallIntegerField()