Merge branch 'master' of https://code.grnet.gr/git/flowspy
[flowspy] / flowspec / migrations / 0002_auto__add_matchprotocol__del_field_route_protocol.py
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 'MatchProtocol'
12         db.create_table(u'match_protocol', (
13             ('protocol', self.gf('django.db.models.fields.CharField')(unique=True, max_length=24)),
14             ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
15         ))
16         db.send_create_signal('flowspec', ['MatchProtocol'])
17
18         # Deleting field 'Route.protocol'
19         db.delete_column(u'route', 'protocol')
20
21         # Adding M2M table for field protocol on 'Route'
22         db.create_table(u'route_protocol', (
23             ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
24             ('route', models.ForeignKey(orm['flowspec.route'], null=False)),
25             ('matchprotocol', models.ForeignKey(orm['flowspec.matchprotocol'], null=False))
26         ))
27         db.create_unique(u'route_protocol', ['route_id', 'matchprotocol_id'])
28     
29     
30     def backwards(self, orm):
31         
32         # Deleting model 'MatchProtocol'
33         db.delete_table(u'match_protocol')
34
35         # Adding field 'Route.protocol'
36         db.add_column(u'route', 'protocol', self.gf('django.db.models.fields.CharField')(max_length=32, null=True, blank=True), keep_default=False)
37
38         # Removing M2M table for field protocol on 'Route'
39         db.delete_table('route_protocol')
40     
41     
42     models = {
43         'auth.group': {
44             'Meta': {'object_name': 'Group'},
45             'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
46             'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
47             'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
48         },
49         'auth.permission': {
50             'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
51             'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
52             'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
53             'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
54             'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
55         },
56         'auth.user': {
57             'Meta': {'object_name': 'User'},
58             'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
59             'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
60             'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
61             'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
62             'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
63             'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
64             'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
65             'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
66             'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
67             'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
68             'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
69             'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
70             'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'})
71         },
72         'contenttypes.contenttype': {
73             'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
74             'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
75             'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
76             'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
77             'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
78         },
79         'flowspec.matchdscp': {
80             'Meta': {'object_name': 'MatchDscp', 'db_table': "u'match_dscp'"},
81             'dscp': ('django.db.models.fields.CharField', [], {'max_length': '24'}),
82             'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
83         },
84         'flowspec.matchport': {
85             'Meta': {'object_name': 'MatchPort', 'db_table': "u'match_port'"},
86             'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
87             'port': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '24'})
88         },
89         'flowspec.matchprotocol': {
90             'Meta': {'object_name': 'MatchProtocol', 'db_table': "u'match_protocol'"},
91             'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
92             'protocol': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '24'})
93         },
94         'flowspec.route': {
95             'Meta': {'object_name': 'Route', 'db_table': "u'route'"},
96             'applier': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
97             'comments': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
98             'destination': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
99             'destinationport': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'matchDestinationPort'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['flowspec.MatchPort']"}),
100             'dscp': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['flowspec.MatchDscp']", 'null': 'True', 'blank': 'True'}),
101             'expires': ('django.db.models.fields.DateField', [], {'default': 'datetime.date(2012, 2, 22)'}),
102             'filed': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
103             'fragmenttype': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}),
104             'icmpcode': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
105             'icmptype': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
106             'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
107             'last_updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
108             'name': ('django.db.models.fields.SlugField', [], {'max_length': '128', 'db_index': 'True'}),
109             'packetlength': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
110             'port': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'matchPort'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['flowspec.MatchPort']"}),
111             'protocol': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['flowspec.MatchProtocol']", 'null': 'True', 'blank': 'True'}),
112             'response': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}),
113             'source': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
114             'sourceport': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'matchSourcePort'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['flowspec.MatchPort']"}),
115             'status': ('django.db.models.fields.CharField', [], {'default': "'PENDING'", 'max_length': '20', 'null': 'True', 'blank': 'True'}),
116             'tcpflag': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
117             'then': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['flowspec.ThenAction']", 'symmetrical': 'False'})
118         },
119         'flowspec.thenaction': {
120             'Meta': {'unique_together': "(('action', 'action_value'),)", 'object_name': 'ThenAction', 'db_table': "u'then_action'"},
121             'action': ('django.db.models.fields.CharField', [], {'max_length': '60'}),
122             'action_value': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
123             'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
124         }
125     }
126     
127     complete_apps = ['flowspec']