Statistics
| Branch: | Tag: | Revision:

root / flowspec / migrations / 0001_initial.py @ f874b20f

History | View | Annotate | Download (13.4 kB)

1
# encoding: utf-8
2
import datetime
3
from south.db import db
4
from south.v2 import SchemaMigration
5
from django.db import models
6

    
7
class Migration(SchemaMigration):
8
    
9
    def forwards(self, orm):
10
        
11
        # Adding model 'MatchPort'
12
        db.create_table(u'match_port', (
13
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
14
            ('port', self.gf('django.db.models.fields.CharField')(unique=True, max_length=24)),
15
        ))
16
        db.send_create_signal('flowspec', ['MatchPort'])
17

    
18
        # Adding model 'MatchDscp'
19
        db.create_table(u'match_dscp', (
20
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
21
            ('dscp', self.gf('django.db.models.fields.CharField')(max_length=24)),
22
        ))
23
        db.send_create_signal('flowspec', ['MatchDscp'])
24

    
25
        # Adding model 'ThenAction'
26
        db.create_table(u'then_action', (
27
            ('action', self.gf('django.db.models.fields.CharField')(max_length=60)),
28
            ('action_value', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)),
29
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
30
        ))
31
        db.send_create_signal('flowspec', ['ThenAction'])
32

    
33
        # Adding unique constraint on 'ThenAction', fields ['action', 'action_value']
34
        db.create_unique(u'then_action', ['action', 'action_value'])
35

    
36
        # Adding model 'Route'
37
        db.create_table(u'route', (
38
            ('packetlength', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
39
            ('status', self.gf('django.db.models.fields.CharField')(default='PENDING', max_length=20, null=True, blank=True)),
40
            ('last_updated', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
41
            ('expires', self.gf('django.db.models.fields.DateField')(default=datetime.date(2012, 2, 22))),
42
            ('protocol', self.gf('django.db.models.fields.CharField')(max_length=32, null=True, blank=True)),
43
            ('name', self.gf('django.db.models.fields.SlugField')(max_length=128, db_index=True)),
44
            ('destination', self.gf('django.db.models.fields.CharField')(max_length=32)),
45
            ('comments', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
46
            ('icmptype', self.gf('django.db.models.fields.CharField')(max_length=32, null=True, blank=True)),
47
            ('source', self.gf('django.db.models.fields.CharField')(max_length=32)),
48
            ('fragmenttype', self.gf('django.db.models.fields.CharField')(max_length=20, null=True, blank=True)),
49
            ('applier', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)),
50
            ('filed', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
51
            ('tcpflag', self.gf('django.db.models.fields.CharField')(max_length=128, null=True, blank=True)),
52
            ('response', self.gf('django.db.models.fields.CharField')(max_length=512, null=True, blank=True)),
53
            ('icmpcode', self.gf('django.db.models.fields.CharField')(max_length=32, null=True, blank=True)),
54
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
55
        ))
56
        db.send_create_signal('flowspec', ['Route'])
57

    
58
        # Adding M2M table for field sourceport on 'Route'
59
        db.create_table(u'route_sourceport', (
60
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
61
            ('route', models.ForeignKey(orm['flowspec.route'], null=False)),
62
            ('matchport', models.ForeignKey(orm['flowspec.matchport'], null=False))
63
        ))
64
        db.create_unique(u'route_sourceport', ['route_id', 'matchport_id'])
65

    
66
        # Adding M2M table for field then on 'Route'
67
        db.create_table(u'route_then', (
68
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
69
            ('route', models.ForeignKey(orm['flowspec.route'], null=False)),
70
            ('thenaction', models.ForeignKey(orm['flowspec.thenaction'], null=False))
71
        ))
72
        db.create_unique(u'route_then', ['route_id', 'thenaction_id'])
73

    
74
        # Adding M2M table for field dscp on 'Route'
75
        db.create_table(u'route_dscp', (
76
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
77
            ('route', models.ForeignKey(orm['flowspec.route'], null=False)),
78
            ('matchdscp', models.ForeignKey(orm['flowspec.matchdscp'], null=False))
79
        ))
80
        db.create_unique(u'route_dscp', ['route_id', 'matchdscp_id'])
81

    
82
        # Adding M2M table for field port on 'Route'
83
        db.create_table(u'route_port', (
84
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
85
            ('route', models.ForeignKey(orm['flowspec.route'], null=False)),
86
            ('matchport', models.ForeignKey(orm['flowspec.matchport'], null=False))
87
        ))
88
        db.create_unique(u'route_port', ['route_id', 'matchport_id'])
89

    
90
        # Adding M2M table for field destinationport on 'Route'
91
        db.create_table(u'route_destinationport', (
92
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
93
            ('route', models.ForeignKey(orm['flowspec.route'], null=False)),
94
            ('matchport', models.ForeignKey(orm['flowspec.matchport'], null=False))
95
        ))
96
        db.create_unique(u'route_destinationport', ['route_id', 'matchport_id'])
97
    
98
    
99
    def backwards(self, orm):
100
        
101
        # Deleting model 'MatchPort'
102
        db.delete_table(u'match_port')
103

    
104
        # Deleting model 'MatchDscp'
105
        db.delete_table(u'match_dscp')
106

    
107
        # Deleting model 'ThenAction'
108
        db.delete_table(u'then_action')
109

    
110
        # Removing unique constraint on 'ThenAction', fields ['action', 'action_value']
111
        db.delete_unique(u'then_action', ['action', 'action_value'])
112

    
113
        # Deleting model 'Route'
114
        db.delete_table(u'route')
115

    
116
        # Removing M2M table for field sourceport on 'Route'
117
        db.delete_table('route_sourceport')
118

    
119
        # Removing M2M table for field then on 'Route'
120
        db.delete_table('route_then')
121

    
122
        # Removing M2M table for field dscp on 'Route'
123
        db.delete_table('route_dscp')
124

    
125
        # Removing M2M table for field port on 'Route'
126
        db.delete_table('route_port')
127

    
128
        # Removing M2M table for field destinationport on 'Route'
129
        db.delete_table('route_destinationport')
130
    
131
    
132
    models = {
133
        'auth.group': {
134
            'Meta': {'object_name': 'Group'},
135
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
136
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
137
            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
138
        },
139
        'auth.permission': {
140
            'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
141
            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
142
            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
143
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
144
            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
145
        },
146
        'auth.user': {
147
            'Meta': {'object_name': 'User'},
148
            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
149
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
150
            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
151
            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
152
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
153
            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
154
            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
155
            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
156
            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
157
            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
158
            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
159
            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
160
            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'})
161
        },
162
        'contenttypes.contenttype': {
163
            'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
164
            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
165
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
166
            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
167
            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
168
        },
169
        'flowspec.matchdscp': {
170
            'Meta': {'object_name': 'MatchDscp', 'db_table': "u'match_dscp'"},
171
            'dscp': ('django.db.models.fields.CharField', [], {'max_length': '24'}),
172
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
173
        },
174
        'flowspec.matchport': {
175
            'Meta': {'object_name': 'MatchPort', 'db_table': "u'match_port'"},
176
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
177
            'port': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '24'})
178
        },
179
        'flowspec.route': {
180
            'Meta': {'object_name': 'Route', 'db_table': "u'route'"},
181
            'applier': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
182
            'comments': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
183
            'destination': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
184
            'destinationport': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'matchDestinationPort'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['flowspec.MatchPort']"}),
185
            'dscp': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['flowspec.MatchDscp']", 'null': 'True', 'blank': 'True'}),
186
            'expires': ('django.db.models.fields.DateField', [], {'default': 'datetime.date(2012, 2, 22)'}),
187
            'filed': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
188
            'fragmenttype': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}),
189
            'icmpcode': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
190
            'icmptype': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
191
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
192
            'last_updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
193
            'name': ('django.db.models.fields.SlugField', [], {'max_length': '128', 'db_index': 'True'}),
194
            'packetlength': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
195
            'port': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'matchPort'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['flowspec.MatchPort']"}),
196
            'protocol': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
197
            'response': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}),
198
            'source': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
199
            'sourceport': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'matchSourcePort'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['flowspec.MatchPort']"}),
200
            'status': ('django.db.models.fields.CharField', [], {'default': "'PENDING'", 'max_length': '20', 'null': 'True', 'blank': 'True'}),
201
            'tcpflag': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
202
            'then': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['flowspec.ThenAction']", 'symmetrical': 'False'})
203
        },
204
        'flowspec.thenaction': {
205
            'Meta': {'unique_together': "(('action', 'action_value'),)", 'object_name': 'ThenAction', 'db_table': "u'then_action'"},
206
            'action': ('django.db.models.fields.CharField', [], {'max_length': '60'}),
207
            'action_value': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
208
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
209
        }
210
    }
211
    
212
    complete_apps = ['flowspec']