add migration for timestamp fields

This commit is contained in:
Jan Dittberner 2014-05-24 22:02:14 +02:00
parent 3473b14e62
commit 3de357d394

View file

@ -0,0 +1,140 @@
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'MailAddressMailbox.created'
db.add_column(u'managemails_mailaddressmailbox', 'created',
self.gf('model_utils.fields.AutoCreatedField')(default=datetime.datetime.now),
keep_default=False)
# Adding field 'MailAddressMailbox.modified'
db.add_column(u'managemails_mailaddressmailbox', 'modified',
self.gf('model_utils.fields.AutoLastModifiedField')(default=datetime.datetime.now),
keep_default=False)
# Adding field 'MailDomain.created'
db.add_column(u'managemails_maildomain', 'created',
self.gf('model_utils.fields.AutoCreatedField')(default=datetime.datetime.now),
keep_default=False)
# Adding field 'MailDomain.modified'
db.add_column(u'managemails_maildomain', 'modified',
self.gf('model_utils.fields.AutoLastModifiedField')(default=datetime.datetime.now),
keep_default=False)
# Adding field 'Mailbox.created'
db.add_column(u'managemails_mailbox', 'created',
self.gf('model_utils.fields.AutoCreatedField')(default=datetime.datetime.now),
keep_default=False)
# Adding field 'Mailbox.modified'
db.add_column(u'managemails_mailbox', 'modified',
self.gf('model_utils.fields.AutoLastModifiedField')(default=datetime.datetime.now),
keep_default=False)
# Adding field 'MailAddress.created'
db.add_column(u'managemails_mailaddress', 'created',
self.gf('model_utils.fields.AutoCreatedField')(default=datetime.datetime.now),
keep_default=False)
# Adding field 'MailAddress.modified'
db.add_column(u'managemails_mailaddress', 'modified',
self.gf('model_utils.fields.AutoLastModifiedField')(default=datetime.datetime.now),
keep_default=False)
# Adding field 'MailAddressForward.created'
db.add_column(u'managemails_mailaddressforward', 'created',
self.gf('model_utils.fields.AutoCreatedField')(default=datetime.datetime.now),
keep_default=False)
# Adding field 'MailAddressForward.modified'
db.add_column(u'managemails_mailaddressforward', 'modified',
self.gf('model_utils.fields.AutoLastModifiedField')(default=datetime.datetime.now),
keep_default=False)
def backwards(self, orm):
# Deleting field 'MailAddressMailbox.created'
db.delete_column(u'managemails_mailaddressmailbox', 'created')
# Deleting field 'MailAddressMailbox.modified'
db.delete_column(u'managemails_mailaddressmailbox', 'modified')
# Deleting field 'MailDomain.created'
db.delete_column(u'managemails_maildomain', 'created')
# Deleting field 'MailDomain.modified'
db.delete_column(u'managemails_maildomain', 'modified')
# Deleting field 'Mailbox.created'
db.delete_column(u'managemails_mailbox', 'created')
# Deleting field 'Mailbox.modified'
db.delete_column(u'managemails_mailbox', 'modified')
# Deleting field 'MailAddress.created'
db.delete_column(u'managemails_mailaddress', 'created')
# Deleting field 'MailAddress.modified'
db.delete_column(u'managemails_mailaddress', 'modified')
# Deleting field 'MailAddressForward.created'
db.delete_column(u'managemails_mailaddressforward', 'created')
# Deleting field 'MailAddressForward.modified'
db.delete_column(u'managemails_mailaddressforward', 'modified')
models = {
u'managemails.mailaddress': {
'Meta': {'unique_together': "(('localpart', 'domain'),)", 'object_name': 'MailAddress'},
'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'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'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'})
},
u'managemails.mailaddressforward': {
'Meta': {'unique_together': "(('mailaddress', 'target'),)", 'object_name': 'MailAddressForward'},
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'mailaddress': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['managemails.MailAddress']"}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'target': ('django.db.models.fields.EmailField', [], {'max_length': '254'})
},
u'managemails.mailaddressmailbox': {
'Meta': {'unique_together': "(('mailaddress', 'mailbox'),)", 'object_name': 'MailAddressMailbox'},
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'mailaddress': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['managemails.MailAddress']", 'unique': 'True', 'primary_key': 'True'}),
'mailbox': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['managemails.Mailbox']"}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'})
},
u'managemails.mailbox': {
'Meta': {'object_name': 'Mailbox'},
'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'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'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'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'},
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'domain': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'})
}
}
complete_apps = ['managemails']