Source

HackersEdge / he_one / migrations / 0002_auto__add_missionobjectives__add_mailbox__add_pcfile__add_objective__a.py

Kevin Veroneau 8d6c3a4 
























































































































































































































































































































# -*- 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 model 'MissionObjectives'
        db.create_table('he_one_missionobjectives', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('objective', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['he_one.Objective'])),
            ('mission', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['he_one.Mission'])),
            ('order', self.gf('django.db.models.fields.PositiveSmallIntegerField')()),
        ))
        db.send_create_signal('he_one', ['MissionObjectives'])

        # Adding model 'Mailbox'
        db.create_table('he_one_mailbox', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('owner', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
        ))
        db.send_create_signal('he_one', ['Mailbox'])

        # Adding M2M table for field messages on 'Mailbox'
        db.create_table('he_one_mailbox_messages', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('mailbox', models.ForeignKey(orm['he_one.mailbox'], null=False)),
            ('message', models.ForeignKey(orm['he_one.message'], null=False))
        ))
        db.create_unique('he_one_mailbox_messages', ['mailbox_id', 'message_id'])

        # Adding model 'PCFile'
        db.create_table('he_one_pcfile', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('filename', self.gf('django.db.models.fields.CharField')(max_length=8)),
            ('file_type', self.gf('django.db.models.fields.CharField')(max_length=3)),
            ('content', self.gf('django.db.models.fields.TextField')()),
        ))
        db.send_create_signal('he_one', ['PCFile'])

        # Adding model 'Objective'
        db.create_table('he_one_objective', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('content_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'])),
            ('object_id', self.gf('django.db.models.fields.PositiveIntegerField')()),
            ('action', self.gf('django.db.models.fields.PositiveSmallIntegerField')()),
            ('is_object', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('exp', self.gf('django.db.models.fields.PositiveIntegerField')()),
        ))
        db.send_create_signal('he_one', ['Objective'])

        # Adding model 'Mission'
        db.create_table('he_one_mission', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('title', self.gf('django.db.models.fields.CharField')(max_length=80)),
            ('description', self.gf('django.db.models.fields.TextField')()),
            ('level', self.gf('django.db.models.fields.PositiveSmallIntegerField')()),
            ('cash', self.gf('django.db.models.fields.PositiveIntegerField')()),
            ('owner', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
        ))
        db.send_create_signal('he_one', ['Mission'])

        # Adding model 'FilePermission'
        db.create_table('he_one_filepermission', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('pcfile', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['he_one.PCFile'])),
            ('host', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['he_one.Host'])),
            ('creator', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
            ('create_date', self.gf('django.db.models.fields.DateTimeField')()),
            ('is_hidden', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('deleted', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('patch', self.gf('django.db.models.fields.IntegerField')()),
        ))
        db.send_create_signal('he_one', ['FilePermission'])

        # Adding model 'Message'
        db.create_table('he_one_message', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('from_user', self.gf('django.db.models.fields.related.ForeignKey')(related_name='sent_set', to=orm['auth.User'])),
            ('to_user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
            ('subject', self.gf('django.db.models.fields.CharField')(max_length=80)),
            ('body', self.gf('django.db.models.fields.TextField')()),
        ))
        db.send_create_signal('he_one', ['Message'])

        # Adding M2M table for field attachments on 'Message'
        db.create_table('he_one_message_attachments', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('message', models.ForeignKey(orm['he_one.message'], null=False)),
            ('pcfile', models.ForeignKey(orm['he_one.pcfile'], null=False))
        ))
        db.create_unique('he_one_message_attachments', ['message_id', 'pcfile_id'])

        # Adding model 'Log'
        db.create_table('he_one_log', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('by_who', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
            ('message', self.gf('django.db.models.fields.CharField')(max_length=80)),
            ('logged_at', self.gf('django.db.models.fields.DateTimeField')()),
            ('deleted', self.gf('django.db.models.fields.BooleanField')(default=False)),
        ))
        db.send_create_signal('he_one', ['Log'])

        # Adding field 'Host.is_booted'
        db.add_column('he_one_host', 'is_booted',
                      self.gf('django.db.models.fields.BooleanField')(default=False),
                      keep_default=False)

        # Adding field 'Host.supports_mail'
        db.add_column('he_one_host', 'supports_mail',
                      self.gf('django.db.models.fields.BooleanField')(default=False),
                      keep_default=False)

        # Adding M2M table for field mailboxes on 'Host'
        db.create_table('he_one_host_mailboxes', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('host', models.ForeignKey(orm['he_one.host'], null=False)),
            ('mailbox', models.ForeignKey(orm['he_one.mailbox'], null=False))
        ))
        db.create_unique('he_one_host_mailboxes', ['host_id', 'mailbox_id'])

        # Adding M2M table for field logs on 'Host'
        db.create_table('he_one_host_logs', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('host', models.ForeignKey(orm['he_one.host'], null=False)),
            ('log', models.ForeignKey(orm['he_one.log'], null=False))
        ))
        db.create_unique('he_one_host_logs', ['host_id', 'log_id'])


    def backwards(self, orm):
        # Deleting model 'MissionObjectives'
        db.delete_table('he_one_missionobjectives')

        # Deleting model 'Mailbox'
        db.delete_table('he_one_mailbox')

        # Removing M2M table for field messages on 'Mailbox'
        db.delete_table('he_one_mailbox_messages')

        # Deleting model 'PCFile'
        db.delete_table('he_one_pcfile')

        # Deleting model 'Objective'
        db.delete_table('he_one_objective')

        # Deleting model 'Mission'
        db.delete_table('he_one_mission')

        # Deleting model 'FilePermission'
        db.delete_table('he_one_filepermission')

        # Deleting model 'Message'
        db.delete_table('he_one_message')

        # Removing M2M table for field attachments on 'Message'
        db.delete_table('he_one_message_attachments')

        # Deleting model 'Log'
        db.delete_table('he_one_log')

        # Deleting field 'Host.is_booted'
        db.delete_column('he_one_host', 'is_booted')

        # Deleting field 'Host.supports_mail'
        db.delete_column('he_one_host', 'supports_mail')

        # Removing M2M table for field mailboxes on 'Host'
        db.delete_table('he_one_host_mailboxes')

        # Removing M2M table for field logs on 'Host'
        db.delete_table('he_one_host_logs')


    models = {
        'auth.group': {
            'Meta': {'object_name': 'Group'},
            '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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
        },
        'auth.permission': {
            'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
        },
        'auth.user': {
            'Meta': {'object_name': 'User'},
            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            '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_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
        },
        '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'}),
            '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'})
        },
        'he_one.filepermission': {
            'Meta': {'object_name': 'FilePermission'},
            'create_date': ('django.db.models.fields.DateTimeField', [], {}),
            'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
            'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'host': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['he_one.Host']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'is_hidden': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'patch': ('django.db.models.fields.IntegerField', [], {}),
            'pcfile': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['he_one.PCFile']"})
        },
        'he_one.host': {
            'Meta': {'object_name': 'Host'},
            'files': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['he_one.PCFile']", 'through': "orm['he_one.FilePermission']", 'symmetrical': 'False'}),
            'gateway': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['he_one.Host']", 'null': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'ip': ('django.db.models.fields.IPAddressField', [], {'unique': 'True', 'max_length': '15', 'db_index': 'True'}),
            'is_booted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'is_router': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'logs': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['he_one.Log']", 'null': 'True', 'blank': 'True'}),
            'mailboxes': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['he_one.Mailbox']", 'null': 'True', 'blank': 'True'}),
            'owner': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'hosts'", 'to': "orm['auth.User']"}),
            'supports_mail': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'users': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']", 'through': "orm['he_one.UserPermission']", 'symmetrical': 'False'})
        },
        'he_one.log': {
            'Meta': {'object_name': 'Log'},
            'by_who': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
            'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'logged_at': ('django.db.models.fields.DateTimeField', [], {}),
            'message': ('django.db.models.fields.CharField', [], {'max_length': '80'})
        },
        'he_one.mailbox': {
            'Meta': {'object_name': 'Mailbox'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'messages': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['he_one.Message']", 'null': 'True', 'blank': 'True'}),
            'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
        },
        'he_one.message': {
            'Meta': {'object_name': 'Message'},
            'attachments': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['he_one.PCFile']", 'null': 'True', 'blank': 'True'}),
            'body': ('django.db.models.fields.TextField', [], {}),
            'from_user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'sent_set'", 'to': "orm['auth.User']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'subject': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
            'to_user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
        },
        'he_one.mission': {
            'Meta': {'object_name': 'Mission'},
            'cash': ('django.db.models.fields.PositiveIntegerField', [], {}),
            'description': ('django.db.models.fields.TextField', [], {}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'level': ('django.db.models.fields.PositiveSmallIntegerField', [], {}),
            'objectives': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['he_one.Objective']", 'through': "orm['he_one.MissionObjectives']", 'symmetrical': 'False'}),
            'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '80'})
        },
        'he_one.missionobjectives': {
            'Meta': {'object_name': 'MissionObjectives'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'mission': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['he_one.Mission']"}),
            'objective': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['he_one.Objective']"}),
            'order': ('django.db.models.fields.PositiveSmallIntegerField', [], {})
        },
        'he_one.namesystem': {
            'Meta': {'unique_together': "(('hostname', 'domain'),)", 'object_name': 'NameSystem'},
            'domain': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
            'host': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['he_one.Host']"}),
            'hostname': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '51'})
        },
        'he_one.objective': {
            'Meta': {'object_name': 'Objective'},
            'action': ('django.db.models.fields.PositiveSmallIntegerField', [], {}),
            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
            'exp': ('django.db.models.fields.PositiveIntegerField', [], {}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'is_object': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'object_id': ('django.db.models.fields.PositiveIntegerField', [], {})
        },
        'he_one.pcfile': {
            'Meta': {'object_name': 'PCFile'},
            'content': ('django.db.models.fields.TextField', [], {}),
            'file_type': ('django.db.models.fields.CharField', [], {'max_length': '3'}),
            'filename': ('django.db.models.fields.CharField', [], {'max_length': '8'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
        },
        'he_one.userpermission': {
            'Meta': {'object_name': 'UserPermission'},
            'host': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['he_one.Host']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
        }
    }

    complete_apps = ['he_one']