Revision 49776400

b/snf-cyclades-app/synnefo/db/migrations/0076_auto__add_volume__add_volumemetadata__add_unique_volumemetadata_volume.py
1
# -*- coding: 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

  
8
class Migration(SchemaMigration):
9

  
10
    def forwards(self, orm):
11
        # Adding model 'Volume'
12
        db.create_table('db_volume', (
13
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
14
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)),
15
            ('description', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)),
16
            ('userid', self.gf('django.db.models.fields.CharField')(max_length=100, db_index=True)),
17
            ('size', self.gf('django.db.models.fields.IntegerField')()),
18
            ('source_image_id', self.gf('django.db.models.fields.CharField')(max_length=100, null=True)),
19
            ('source_snapshot_id', self.gf('django.db.models.fields.CharField')(max_length=100, null=True)),
20
            ('source_volume', self.gf('django.db.models.fields.related.ForeignKey')(related_name='cloned_volumes', null=True, to=orm['db.Volume'])),
21
            ('deleted', self.gf('django.db.models.fields.BooleanField')(default=False)),
22
            ('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
23
            ('updated', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
24
            ('status', self.gf('django.db.models.fields.CharField')(default='CREATING', max_length=64)),
25
            ('snapshot_counter', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
26
            ('machine', self.gf('django.db.models.fields.related.ForeignKey')(related_name='volumes', null=True, to=orm['db.VirtualMachine'])),
27
            ('index', self.gf('django.db.models.fields.IntegerField')(null=True)),
28
            ('backendjobid', self.gf('django.db.models.fields.PositiveIntegerField')(null=True)),
29
        ))
30
        db.send_create_signal('db', ['Volume'])
31

  
32
        # Adding model 'VolumeMetadata'
33
        db.create_table('db_volumemetadata', (
34
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
35
            ('key', self.gf('django.db.models.fields.CharField')(max_length=64)),
36
            ('value', self.gf('django.db.models.fields.CharField')(max_length=255)),
37
            ('volume', self.gf('django.db.models.fields.related.ForeignKey')(related_name='metadata', to=orm['db.Volume'])),
38
        ))
39
        db.send_create_signal('db', ['VolumeMetadata'])
40

  
41
        # Adding unique constraint on 'VolumeMetadata', fields ['volume', 'key']
42
        db.create_unique('db_volumemetadata', ['volume_id', 'key'])
43

  
44

  
45
    def backwards(self, orm):
46
        # Removing unique constraint on 'NetworkInterface', fields ['network', 'ipv4']
47
        db.delete_unique('db_networkinterface', ['network_id', 'ipv4'])
48

  
49
        # Removing unique constraint on 'VolumeMetadata', fields ['volume', 'key']
50
        db.delete_unique('db_volumemetadata', ['volume_id', 'key'])
51

  
52
        # Deleting model 'Volume'
53
        db.delete_table('db_volume')
54

  
55
        # Deleting model 'VolumeMetadata'
56
        db.delete_table('db_volumemetadata')
57

  
58

  
59
    models = {
60
        'db.backend': {
61
            'Meta': {'ordering': "['clustername']", 'object_name': 'Backend'},
62
            'clustername': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
63
            'ctotal': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
64
            'dfree': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
65
            'disk_templates': ('synnefo.db.fields.SeparatedValuesField', [], {'null': 'True'}),
66
            'drained': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
67
            'dtotal': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
68
            'hash': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
69
            'hypervisor': ('django.db.models.fields.CharField', [], {'default': "'kvm'", 'max_length': '32'}),
70
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
71
            'index': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'unique': 'True'}),
72
            'mfree': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
73
            'mtotal': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
74
            'offline': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
75
            'password_hash': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
76
            'pinst_cnt': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
77
            'port': ('django.db.models.fields.PositiveIntegerField', [], {'default': '5080'}),
78
            'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
79
            'username': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True', 'blank': 'True'})
80
        },
81
        'db.backendnetwork': {
82
            'Meta': {'unique_together': "(('network', 'backend'),)", 'object_name': 'BackendNetwork'},
83
            'backend': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'networks'", 'on_delete': 'models.PROTECT', 'to': "orm['db.Backend']"}),
84
            'backendjobid': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True'}),
85
            'backendjobstatus': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True'}),
86
            'backendlogmsg': ('django.db.models.fields.TextField', [], {'null': 'True'}),
87
            'backendopcode': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True'}),
88
            'backendtime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(1, 1, 1, 0, 0)'}),
89
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
90
            'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
91
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
92
            'mac_prefix': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
93
            'network': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'backend_networks'", 'to': "orm['db.Network']"}),
94
            'operstate': ('django.db.models.fields.CharField', [], {'default': "'PENDING'", 'max_length': '30'}),
95
            'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
96
        },
97
        'db.bridgepooltable': {
98
            'Meta': {'object_name': 'BridgePoolTable'},
99
            'available_map': ('django.db.models.fields.TextField', [], {'default': "''"}),
100
            'base': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}),
101
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
102
            'offset': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
103
            'reserved_map': ('django.db.models.fields.TextField', [], {'default': "''"}),
104
            'size': ('django.db.models.fields.IntegerField', [], {})
105
        },
106
        'db.flavor': {
107
            'Meta': {'unique_together': "(('cpu', 'ram', 'disk', 'disk_template'),)", 'object_name': 'Flavor'},
108
            'cpu': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
109
            'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
110
            'disk': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
111
            'disk_template': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
112
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
113
            'ram': ('django.db.models.fields.IntegerField', [], {'default': '0'})
114
        },
115
        'db.floatingip': {
116
            'Meta': {'object_name': 'FloatingIP'},
117
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
118
            'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
119
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
120
            'ipv4': ('django.db.models.fields.IPAddressField', [], {'unique': 'True', 'max_length': '15', 'db_index': 'True'}),
121
            'machine': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'floating_ips'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['db.VirtualMachine']"}),
122
            'network': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'floating_ips'", 'to': "orm['db.Network']"}),
123
            'serial': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'floating_ips'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['db.QuotaHolderSerial']"}),
124
            'userid': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'})
125
        },
126
        'db.ippooltable': {
127
            'Meta': {'object_name': 'IPPoolTable'},
128
            'available_map': ('django.db.models.fields.TextField', [], {'default': "''"}),
129
            'base': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}),
130
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
131
            'offset': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
132
            'reserved_map': ('django.db.models.fields.TextField', [], {'default': "''"}),
133
            'size': ('django.db.models.fields.IntegerField', [], {})
134
        },
135
        'db.macprefixpooltable': {
136
            'Meta': {'object_name': 'MacPrefixPoolTable'},
137
            'available_map': ('django.db.models.fields.TextField', [], {'default': "''"}),
138
            'base': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}),
139
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
140
            'offset': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
141
            'reserved_map': ('django.db.models.fields.TextField', [], {'default': "''"}),
142
            'size': ('django.db.models.fields.IntegerField', [], {})
143
        },
144
        'db.network': {
145
            'Meta': {'object_name': 'Network'},
146
            'action': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '32', 'null': 'True'}),
147
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
148
            'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
149
            'dhcp': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
150
            'drained': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
151
            'flavor': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
152
            'floating_ip_pool': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
153
            'gateway': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}),
154
            'gateway6': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
155
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
156
            'link': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}),
157
            'mac_prefix': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
158
            'machines': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['db.VirtualMachine']", 'through': "orm['db.NetworkInterface']", 'symmetrical': 'False'}),
159
            'mode': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True'}),
160
            'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
161
            'pool': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'network'", 'unique': 'True', 'null': 'True', 'to': "orm['db.IPPoolTable']"}),
162
            'public': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
163
            'serial': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'network'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['db.QuotaHolderSerial']"}),
164
            'state': ('django.db.models.fields.CharField', [], {'default': "'PENDING'", 'max_length': '32'}),
165
            'subnet': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}),
166
            'subnet6': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
167
            'tags': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}),
168
            'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
169
            'userid': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'db_index': 'True'})
170
        },
171
        'db.networkinterface': {
172
            'Meta': {'unique_together': "(('network', 'ipv4'),)", 'object_name': 'NetworkInterface'},
173
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
174
            'firewall_profile': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True'}),
175
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
176
            'index': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
177
            'ip_type': ('django.db.models.fields.CharField', [], {'default': "'FIXED'", 'max_length': '32'}),
178
            'ipv4': ('django.db.models.fields.CharField', [], {'max_length': '15', 'null': 'True'}),
179
            'ipv6': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True'}),
180
            'mac': ('django.db.models.fields.CharField', [], {'max_length': '32', 'unique': 'True', 'null': 'True'}),
181
            'machine': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'nics'", 'to': "orm['db.VirtualMachine']"}),
182
            'network': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'nics'", 'to': "orm['db.Network']"}),
183
            'state': ('django.db.models.fields.CharField', [], {'default': "'ACTIVE'", 'max_length': '32'}),
184
            'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
185
        },
186
        'db.quotaholderserial': {
187
            'Meta': {'ordering': "['serial']", 'object_name': 'QuotaHolderSerial'},
188
            'accept': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
189
            'pending': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}),
190
            'resolved': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
191
            'serial': ('django.db.models.fields.BigIntegerField', [], {'primary_key': 'True', 'db_index': 'True'})
192
        },
193
        'db.virtualmachine': {
194
            'Meta': {'object_name': 'VirtualMachine'},
195
            'action': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '30', 'null': 'True'}),
196
            'backend': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'virtual_machines'", 'null': 'True', 'on_delete': 'models.PROTECT', 'to': "orm['db.Backend']"}),
197
            'backend_hash': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}),
198
            'backendjobid': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True'}),
199
            'backendjobstatus': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True'}),
200
            'backendlogmsg': ('django.db.models.fields.TextField', [], {'null': 'True'}),
201
            'backendopcode': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True'}),
202
            'backendtime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(1, 1, 1, 0, 0)'}),
203
            'buildpercentage': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
204
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
205
            'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
206
            'flavor': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['db.Flavor']", 'on_delete': 'models.PROTECT'}),
207
            'hostid': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
208
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
209
            'imageid': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
210
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
211
            'operstate': ('django.db.models.fields.CharField', [], {'default': "'BUILD'", 'max_length': '30'}),
212
            'serial': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'virtual_machine'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['db.QuotaHolderSerial']"}),
213
            'suspended': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
214
            'task': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
215
            'task_job_id': ('django.db.models.fields.BigIntegerField', [], {'null': 'True'}),
216
            'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
217
            'userid': ('django.db.models.fields.CharField', [], {'max_length': '100', 'db_index': 'True'})
218
        },
219
        'db.virtualmachinediagnostic': {
220
            'Meta': {'ordering': "['-created']", 'object_name': 'VirtualMachineDiagnostic'},
221
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
222
            'details': ('django.db.models.fields.TextField', [], {'null': 'True'}),
223
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
224
            'level': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
225
            'machine': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'diagnostics'", 'to': "orm['db.VirtualMachine']"}),
226
            'message': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
227
            'source': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
228
            'source_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True'})
229
        },
230
        'db.virtualmachinemetadata': {
231
            'Meta': {'unique_together': "(('meta_key', 'vm'),)", 'object_name': 'VirtualMachineMetadata'},
232
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
233
            'meta_key': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
234
            'meta_value': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
235
            'vm': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'metadata'", 'to': "orm['db.VirtualMachine']"})
236
        },
237
        'db.volume': {
238
            'Meta': {'object_name': 'Volume'},
239
            'backendjobid': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True'}),
240
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
241
            'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
242
            'description': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}),
243
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
244
            'index': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
245
            'machine': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'volumes'", 'null': 'True', 'to': "orm['db.VirtualMachine']"}),
246
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}),
247
            'size': ('django.db.models.fields.IntegerField', [], {}),
248
            'snapshot_counter': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
249
            'source_image_id': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True'}),
250
            'source_snapshot_id': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True'}),
251
            'source_volume': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'cloned_volumes'", 'null': 'True', 'to': "orm['db.Volume']"}),
252
            'status': ('django.db.models.fields.CharField', [], {'default': "'CREATING'", 'max_length': '64'}),
253
            'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
254
            'userid': ('django.db.models.fields.CharField', [], {'max_length': '100', 'db_index': 'True'})
255
        },
256
        'db.volumemetadata': {
257
            'Meta': {'unique_together': "(('volume', 'key'),)", 'object_name': 'VolumeMetadata'},
258
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
259
            'key': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
260
            'value': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
261
            'volume': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'metadata'", 'to': "orm['db.Volume']"})
262
        }
263
    }
264

  
265
    complete_apps = ['db']

Also available in: Unified diff