2013-07-26 16:51:02 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import datetime
|
|
|
|
from south.db import db
|
|
|
|
from south.v2 import SchemaMigration
|
|
|
|
from django.db import models
|
|
|
|
|
2013-07-29 23:03:31 +02:00
|
|
|
def rename(old_name, new_name):
|
|
|
|
for table_name in ['zephyr_realm',
|
|
|
|
'zephyr_userprofile',
|
|
|
|
'zephyr_client',
|
|
|
|
'zephyr_huddle',
|
|
|
|
'zephyr_mituser',
|
|
|
|
'zephyr_message',
|
|
|
|
'zephyr_usermessage',
|
|
|
|
'zephyr_stream',
|
|
|
|
'zephyr_streamcolor',
|
|
|
|
'zephyr_useractivity',
|
|
|
|
'zephyr_userpresence',
|
|
|
|
'zephyr_referral',
|
|
|
|
'zephyr_recipient',
|
|
|
|
'zephyr_preregistrationuser',
|
|
|
|
'zephyr_preregistrationuser_streams',
|
|
|
|
'zephyr_subscription',
|
|
|
|
'zephyr_defaultstream',
|
|
|
|
'zephyr_userprofile_user_permissions',
|
|
|
|
'zephyr_userprofile_groups']:
|
|
|
|
db.rename_table(table_name.replace(new_name, old_name),
|
|
|
|
table_name.replace(old_name, new_name))
|
2013-07-26 16:51:02 +02:00
|
|
|
|
|
|
|
class Migration(SchemaMigration):
|
|
|
|
|
|
|
|
def forwards(self, orm):
|
2013-07-29 23:03:31 +02:00
|
|
|
rename("zephyr", "zerver")
|
2013-07-26 16:51:02 +02:00
|
|
|
|
2013-07-29 23:03:31 +02:00
|
|
|
create_signals = db.get_pending_creates()
|
|
|
|
for i in xrange(0, len(create_signals)):
|
|
|
|
if create_signals[i][0] == 'zephyr':
|
|
|
|
create_signals[i] = ('zerver', create_signals[i][1])
|
2013-07-26 16:51:02 +02:00
|
|
|
|
|
|
|
def backwards(self, orm):
|
2013-07-29 23:03:31 +02:00
|
|
|
rename("zerver", "zephyr")
|
2013-07-26 16:51:02 +02:00
|
|
|
|
2013-07-29 23:03:31 +02:00
|
|
|
create_signals = db.get_pending_creates()
|
|
|
|
for i in xrange(0, len(create_signals)):
|
|
|
|
if create_signals[i][0] == 'zerver':
|
|
|
|
create_signals[i] = ('zephyr', create_signals[i][1])
|
|
|
|
pass
|
2013-07-26 16:51:02 +02:00
|
|
|
|
|
|
|
models = {
|
|
|
|
u'auth.group': {
|
|
|
|
'Meta': {'object_name': 'Group'},
|
|
|
|
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
|
|
|
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
|
|
|
|
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
|
|
|
|
},
|
|
|
|
u'auth.permission': {
|
|
|
|
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
|
|
|
|
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
|
|
|
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
|
|
|
|
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
|
|
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
|
|
|
|
},
|
|
|
|
u'contenttypes.contenttype': {
|
|
|
|
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
|
|
|
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
|
|
|
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
|
|
|
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
|
|
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
|
|
|
|
},
|
2013-07-29 23:03:31 +02:00
|
|
|
u'zerver.client': {
|
2013-07-26 16:51:02 +02:00
|
|
|
'Meta': {'object_name': 'Client'},
|
|
|
|
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
|
|
|
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30', 'db_index': 'True'})
|
|
|
|
},
|
2013-07-29 23:03:31 +02:00
|
|
|
u'zerver.defaultstream': {
|
2013-07-26 16:51:02 +02:00
|
|
|
'Meta': {'unique_together': "(('realm', 'stream'),)", 'object_name': 'DefaultStream'},
|
|
|
|
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
2013-07-29 23:03:31 +02:00
|
|
|
'realm': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['zerver.Realm']"}),
|
|
|
|
'stream': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['zerver.Stream']"})
|
2013-07-26 16:51:02 +02:00
|
|
|
},
|
2013-07-29 23:03:31 +02:00
|
|
|
u'zerver.huddle': {
|
2013-07-26 16:51:02 +02:00
|
|
|
'Meta': {'object_name': 'Huddle'},
|
|
|
|
'huddle_hash': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40', 'db_index': 'True'}),
|
|
|
|
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
|
|
|
|
},
|
2013-07-29 23:03:31 +02:00
|
|
|
u'zerver.message': {
|
2013-07-26 16:51:02 +02:00
|
|
|
'Meta': {'object_name': 'Message'},
|
|
|
|
'content': ('django.db.models.fields.TextField', [], {}),
|
|
|
|
'edit_history': ('django.db.models.fields.TextField', [], {'null': 'True'}),
|
|
|
|
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
|
|
|
'last_edit_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
|
|
|
|
'pub_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
|
2013-07-29 23:03:31 +02:00
|
|
|
'recipient': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['zerver.Recipient']"}),
|
2013-07-26 16:51:02 +02:00
|
|
|
'rendered_content': ('django.db.models.fields.TextField', [], {'null': 'True'}),
|
|
|
|
'rendered_content_version': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
|
2013-07-29 23:03:31 +02:00
|
|
|
'sender': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['zerver.UserProfile']"}),
|
|
|
|
'sending_client': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['zerver.Client']"}),
|
2013-07-26 16:51:02 +02:00
|
|
|
'subject': ('django.db.models.fields.CharField', [], {'max_length': '60', 'db_index': 'True'})
|
|
|
|
},
|
2013-07-29 23:03:31 +02:00
|
|
|
u'zerver.mituser': {
|
2013-07-26 16:51:02 +02:00
|
|
|
'Meta': {'object_name': 'MitUser'},
|
|
|
|
'email': ('django.db.models.fields.EmailField', [], {'unique': 'True', 'max_length': '75'}),
|
|
|
|
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
|
|
|
'status': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
|
|
|
},
|
2013-07-29 23:03:31 +02:00
|
|
|
u'zerver.preregistrationuser': {
|
2013-07-26 16:51:02 +02:00
|
|
|
'Meta': {'object_name': 'PreregistrationUser'},
|
|
|
|
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
|
|
|
|
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
|
|
|
'invited_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
2013-07-29 23:03:31 +02:00
|
|
|
'realm': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['zerver.Realm']", 'null': 'True'}),
|
|
|
|
'referred_by': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['zerver.UserProfile']", 'null': 'True'}),
|
2013-07-26 16:51:02 +02:00
|
|
|
'status': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
2013-07-29 23:03:31 +02:00
|
|
|
'streams': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['zerver.Stream']", 'null': 'True', 'symmetrical': 'False'})
|
2013-07-26 16:51:02 +02:00
|
|
|
},
|
2013-07-29 23:03:31 +02:00
|
|
|
u'zerver.realm': {
|
2013-07-26 16:51:02 +02:00
|
|
|
'Meta': {'object_name': 'Realm'},
|
|
|
|
'domain': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40', 'db_index': 'True'}),
|
|
|
|
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
|
|
|
'restricted_to_domain': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
|
|
|
|
},
|
2013-07-29 23:03:31 +02:00
|
|
|
u'zerver.recipient': {
|
2013-07-26 16:51:02 +02:00
|
|
|
'Meta': {'unique_together': "(('type', 'type_id'),)", 'object_name': 'Recipient'},
|
|
|
|
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
|
|
|
'type': ('django.db.models.fields.PositiveSmallIntegerField', [], {'db_index': 'True'}),
|
|
|
|
'type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'})
|
|
|
|
},
|
2013-07-29 23:03:31 +02:00
|
|
|
u'zerver.referral': {
|
2013-07-26 16:51:02 +02:00
|
|
|
'Meta': {'object_name': 'Referral'},
|
|
|
|
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
|
|
|
|
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
|
|
|
'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
2013-07-29 23:03:31 +02:00
|
|
|
'user_profile': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['zerver.UserProfile']"})
|
2013-07-26 16:51:02 +02:00
|
|
|
},
|
2013-07-29 23:03:31 +02:00
|
|
|
u'zerver.stream': {
|
2013-07-26 16:51:02 +02:00
|
|
|
'Meta': {'unique_together': "(('name', 'realm'),)", 'object_name': 'Stream'},
|
|
|
|
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
|
|
|
'invite_only': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
|
|
|
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'db_index': 'True'}),
|
2013-07-29 23:03:31 +02:00
|
|
|
'realm': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['zerver.Realm']"})
|
2013-07-26 16:51:02 +02:00
|
|
|
},
|
2013-07-29 23:03:31 +02:00
|
|
|
u'zerver.streamcolor': {
|
2013-07-26 16:51:02 +02:00
|
|
|
'Meta': {'object_name': 'StreamColor'},
|
|
|
|
'color': ('django.db.models.fields.CharField', [], {'max_length': '10'}),
|
|
|
|
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
2013-07-29 23:03:31 +02:00
|
|
|
'subscription': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['zerver.Subscription']"})
|
2013-07-26 16:51:02 +02:00
|
|
|
},
|
2013-07-29 23:03:31 +02:00
|
|
|
u'zerver.subscription': {
|
2013-07-26 16:51:02 +02:00
|
|
|
'Meta': {'unique_together': "(('user_profile', 'recipient'),)", 'object_name': 'Subscription'},
|
|
|
|
'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
|
|
|
|
'color': ('django.db.models.fields.CharField', [], {'default': "'#c2c2c2'", 'max_length': '10'}),
|
|
|
|
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
|
|
|
'in_home_view': ('django.db.models.fields.NullBooleanField', [], {'default': 'True', 'null': 'True', 'blank': 'True'}),
|
|
|
|
'notifications': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
2013-07-29 23:03:31 +02:00
|
|
|
'recipient': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['zerver.Recipient']"}),
|
|
|
|
'user_profile': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['zerver.UserProfile']"})
|
2013-07-26 16:51:02 +02:00
|
|
|
},
|
2013-07-29 23:03:31 +02:00
|
|
|
u'zerver.useractivity': {
|
2013-07-26 16:51:02 +02:00
|
|
|
'Meta': {'unique_together': "(('user_profile', 'client', 'query'),)", 'object_name': 'UserActivity'},
|
2013-07-29 23:03:31 +02:00
|
|
|
'client': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['zerver.Client']"}),
|
2013-07-26 16:51:02 +02:00
|
|
|
'count': ('django.db.models.fields.IntegerField', [], {}),
|
|
|
|
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
|
|
|
'last_visit': ('django.db.models.fields.DateTimeField', [], {}),
|
|
|
|
'query': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}),
|
2013-07-29 23:03:31 +02:00
|
|
|
'user_profile': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['zerver.UserProfile']"})
|
2013-07-26 16:51:02 +02:00
|
|
|
},
|
2013-07-29 23:03:31 +02:00
|
|
|
u'zerver.usermessage': {
|
2013-07-26 16:51:02 +02:00
|
|
|
'Meta': {'unique_together': "(('user_profile', 'message'),)", 'object_name': 'UserMessage'},
|
|
|
|
'archived': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
|
|
|
'flags': ('django.db.models.fields.BigIntegerField', [], {'default': '0'}),
|
|
|
|
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
2013-07-29 23:03:31 +02:00
|
|
|
'message': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['zerver.Message']"}),
|
|
|
|
'user_profile': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['zerver.UserProfile']"})
|
2013-07-26 16:51:02 +02:00
|
|
|
},
|
2013-07-29 23:03:31 +02:00
|
|
|
u'zerver.userpresence': {
|
2013-07-26 16:51:02 +02:00
|
|
|
'Meta': {'unique_together': "(('user_profile', 'client'),)", 'object_name': 'UserPresence'},
|
2013-07-29 23:03:31 +02:00
|
|
|
'client': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['zerver.Client']"}),
|
2013-07-26 16:51:02 +02:00
|
|
|
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
|
|
|
'status': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '1'}),
|
|
|
|
'timestamp': ('django.db.models.fields.DateTimeField', [], {}),
|
2013-07-29 23:03:31 +02:00
|
|
|
'user_profile': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['zerver.UserProfile']"})
|
2013-07-26 16:51:02 +02:00
|
|
|
},
|
2013-07-29 23:03:31 +02:00
|
|
|
u'zerver.userprofile': {
|
2013-07-26 16:51:02 +02:00
|
|
|
'Meta': {'object_name': 'UserProfile'},
|
|
|
|
'api_key': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
|
|
|
|
'avatar_source': ('django.db.models.fields.CharField', [], {'default': "'G'", 'max_length': '1'}),
|
2013-07-29 23:03:31 +02:00
|
|
|
'bot_owner': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['zerver.UserProfile']", 'null': 'True', 'on_delete': 'models.SET_NULL'}),
|
2013-07-26 16:51:02 +02:00
|
|
|
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
|
|
|
'email': ('django.db.models.fields.EmailField', [], {'unique': 'True', 'max_length': '75', 'db_index': 'True'}),
|
|
|
|
'enable_desktop_notifications': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
|
|
|
|
'enable_offline_email_notifications': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
|
|
|
|
'enable_sounds': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
|
|
|
|
'enter_sends': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
|
|
|
|
'full_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
|
|
|
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
|
|
|
|
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
|
|
|
'invites_granted': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
|
|
|
'invites_used': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
|
|
|
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
|
|
|
|
'is_bot': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
|
|
|
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
|
|
|
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
|
|
|
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
|
|
|
'last_pointer_updater': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
|
|
|
|
'last_reminder': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True'}),
|
|
|
|
'onboarding_steps': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
|
|
|
|
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
|
|
|
'pointer': ('django.db.models.fields.IntegerField', [], {}),
|
|
|
|
'rate_limits': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '100'}),
|
2013-07-29 23:03:31 +02:00
|
|
|
'realm': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['zerver.Realm']"}),
|
2013-07-26 16:51:02 +02:00
|
|
|
'short_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
|
|
|
'tutorial_status': ('django.db.models.fields.CharField', [], {'default': "'W'", 'max_length': '1'}),
|
|
|
|
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-29 23:03:31 +02:00
|
|
|
complete_apps = ['zerver']
|