Statistics
| Branch: | Tag: | Revision:

root / snf-astakos-app / astakos / im / migrations / 0015_auto__add_groupkind__add_astakosgroup__add_resourcemetadata__add_astak.py @ 76c68fd6

History | View | Annotate | Download (19.9 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 'GroupKind'
12
        db.create_table('im_groupkind', (
13
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
14
            ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255, db_index=True)),
15
        ))
16
        db.send_create_signal('im', ['GroupKind'])
17

    
18
        # Adding model 'AstakosGroup'
19
        db.create_table('im_astakosgroup', (
20
            ('group_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['auth.Group'], unique=True, primary_key=True)),
21
            ('kind', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['im.GroupKind'])),
22
            ('desc', self.gf('django.db.models.fields.TextField')(null=True)),
23
            ('creation_date', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2012, 8, 3, 11, 26, 47, 642626))),
24
            ('issue_date', self.gf('django.db.models.fields.DateTimeField')(null=True)),
25
            ('expiration_date', self.gf('django.db.models.fields.DateTimeField')(null=True)),
26
            ('moderatation_enabled', self.gf('django.db.models.fields.BooleanField')(default=False)),
27
            ('approval_date', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
28
            ('estimated_participants', self.gf('django.db.models.fields.PositiveIntegerField')(null=True)),
29
        ))
30
        db.send_create_signal('im', ['AstakosGroup'])
31

    
32
        # Adding model 'ResourceMetadata'
33
        db.create_table('im_resourcemetadata', (
34
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
35
            ('key', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255, db_index=True)),
36
            ('value', self.gf('django.db.models.fields.CharField')(max_length=255)),
37
        ))
38
        db.send_create_signal('im', ['ResourceMetadata'])
39

    
40
        # Adding model 'AstakosGroupQuota'
41
        db.create_table('im_astakosgroupquota', (
42
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
43
            ('limit', self.gf('django.db.models.fields.PositiveIntegerField')()),
44
            ('resource', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['im.Resource'])),
45
            ('group', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['im.AstakosGroup'], blank=True)),
46
        ))
47
        db.send_create_signal('im', ['AstakosGroupQuota'])
48

    
49
        # Adding unique constraint on 'AstakosGroupQuota', fields ['resource', 'group']
50
        db.create_unique('im_astakosgroupquota', ['resource_id', 'group_id'])
51

    
52
        # Adding model 'Resource'
53
        db.create_table('im_resource', (
54
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
55
            ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255, db_index=True)),
56
            ('service', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['im.Service'])),
57
        ))
58
        db.send_create_signal('im', ['Resource'])
59

    
60
        # Adding M2M table for field meta on 'Resource'
61
        db.create_table('im_resource_meta', (
62
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
63
            ('resource', models.ForeignKey(orm['im.resource'], null=False)),
64
            ('resourcemetadata', models.ForeignKey(orm['im.resourcemetadata'], null=False))
65
        ))
66
        db.create_unique('im_resource_meta', ['resource_id', 'resourcemetadata_id'])
67

    
68
        # Adding model 'Membership'
69
        db.create_table('im_membership', (
70
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
71
            ('person', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['im.AstakosUser'])),
72
            ('group', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['im.AstakosGroup'])),
73
            ('date_requested', self.gf('django.db.models.fields.DateField')(default=datetime.datetime(2012, 8, 3, 11, 26, 47, 646518))),
74
            ('date_joined', self.gf('django.db.models.fields.DateField')(null=True, db_index=True)),
75
        ))
76
        db.send_create_signal('im', ['Membership'])
77

    
78
        # Adding unique constraint on 'Membership', fields ['person', 'group']
79
        db.create_unique('im_membership', ['person_id', 'group_id'])
80

    
81
        # Adding model 'AstakosUserQuota'
82
        db.create_table('im_astakosuserquota', (
83
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
84
            ('limit', self.gf('django.db.models.fields.PositiveIntegerField')()),
85
            ('resource', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['im.Resource'])),
86
            ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['im.AstakosUser'])),
87
        ))
88
        db.send_create_signal('im', ['AstakosUserQuota'])
89

    
90
        # Adding unique constraint on 'AstakosUserQuota', fields ['resource', 'user']
91
        db.create_unique('im_astakosuserquota', ['resource_id', 'user_id'])
92

    
93
        # Adding index on 'Service', fields ['name']
94
        db.create_index('im_service', ['name'])
95

    
96
        # Adding M2M table for field owner on 'AstakosUser'
97
        db.create_table('im_astakosuser_owner', (
98
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
99
            ('astakosuser', models.ForeignKey(orm['im.astakosuser'], null=False)),
100
            ('astakosgroup', models.ForeignKey(orm['im.astakosgroup'], null=False))
101
        ))
102
        db.create_unique('im_astakosuser_owner', ['astakosuser_id', 'astakosgroup_id'])
103

    
104

    
105
    def backwards(self, orm):
106
        
107
        # Removing index on 'Service', fields ['name']
108
        db.delete_index('im_service', ['name'])
109

    
110
        # Removing unique constraint on 'AstakosUserQuota', fields ['resource', 'user']
111
        db.delete_unique('im_astakosuserquota', ['resource_id', 'user_id'])
112

    
113
        # Removing unique constraint on 'Membership', fields ['person', 'group']
114
        db.delete_unique('im_membership', ['person_id', 'group_id'])
115

    
116
        # Removing unique constraint on 'AstakosGroupQuota', fields ['resource', 'group']
117
        db.delete_unique('im_astakosgroupquota', ['resource_id', 'group_id'])
118

    
119
        # Deleting model 'GroupKind'
120
        db.delete_table('im_groupkind')
121

    
122
        # Deleting model 'AstakosGroup'
123
        db.delete_table('im_astakosgroup')
124

    
125
        # Deleting model 'ResourceMetadata'
126
        db.delete_table('im_resourcemetadata')
127

    
128
        # Deleting model 'AstakosGroupQuota'
129
        db.delete_table('im_astakosgroupquota')
130

    
131
        # Deleting model 'Resource'
132
        db.delete_table('im_resource')
133

    
134
        # Removing M2M table for field meta on 'Resource'
135
        db.delete_table('im_resource_meta')
136

    
137
        # Deleting model 'Membership'
138
        db.delete_table('im_membership')
139

    
140
        # Deleting model 'AstakosUserQuota'
141
        db.delete_table('im_astakosuserquota')
142

    
143
        # Removing M2M table for field owner on 'AstakosUser'
144
        db.delete_table('im_astakosuser_owner')
145

    
146

    
147
    models = {
148
        'auth.group': {
149
            'Meta': {'object_name': 'Group'},
150
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
151
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
152
            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
153
        },
154
        'auth.permission': {
155
            'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
156
            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
157
            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
158
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
159
            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
160
        },
161
        'auth.user': {
162
            'Meta': {'object_name': 'User'},
163
            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
164
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
165
            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
166
            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
167
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
168
            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
169
            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
170
            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
171
            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
172
            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
173
            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
174
            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
175
            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
176
        },
177
        'contenttypes.contenttype': {
178
            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
179
            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
180
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
181
            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
182
            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
183
        },
184
        'im.additionalmail': {
185
            'Meta': {'object_name': 'AdditionalMail'},
186
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
187
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
188
            'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.AstakosUser']"})
189
        },
190
        'im.approvalterms': {
191
            'Meta': {'object_name': 'ApprovalTerms'},
192
            'date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2012, 8, 3, 11, 26, 47, 648667)', 'db_index': 'True'}),
193
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
194
            'location': ('django.db.models.fields.CharField', [], {'max_length': '255'})
195
        },
196
        'im.astakosgroup': {
197
            'Meta': {'object_name': 'AstakosGroup', '_ormbases': ['auth.Group']},
198
            'approval_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
199
            'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2012, 8, 3, 11, 26, 47, 642626)'}),
200
            'desc': ('django.db.models.fields.TextField', [], {'null': 'True'}),
201
            'estimated_participants': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True'}),
202
            'expiration_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
203
            'group_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.Group']", 'unique': 'True', 'primary_key': 'True'}),
204
            'issue_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
205
            'kind': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.GroupKind']"}),
206
            'moderatation_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
207
            'policy': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['im.Resource']", 'null': 'True', 'through': "orm['im.AstakosGroupQuota']", 'blank': 'True'})
208
        },
209
        'im.astakosgroupquota': {
210
            'Meta': {'unique_together': "(('resource', 'group'),)", 'object_name': 'AstakosGroupQuota'},
211
            'group': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.AstakosGroup']", 'blank': 'True'}),
212
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
213
            'limit': ('django.db.models.fields.PositiveIntegerField', [], {}),
214
            'resource': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.Resource']"})
215
        },
216
        'im.astakosuser': {
217
            'Meta': {'unique_together': "(('provider', 'third_party_identifier'),)", 'object_name': 'AstakosUser', '_ormbases': ['auth.User']},
218
            'activation_sent': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
219
            'affiliation': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
220
            'astakos_groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['im.AstakosGroup']", 'symmetrical': 'False', 'through': "orm['im.Membership']", 'blank': 'True'}),
221
            'auth_token': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
222
            'auth_token_created': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
223
            'auth_token_expires': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
224
            'date_signed_terms': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
225
            'email_verified': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
226
            'has_credits': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
227
            'has_signed_terms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
228
            'invitations': ('django.db.models.fields.IntegerField', [], {'default': '100'}),
229
            'is_verified': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
230
            'level': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
231
            'owner': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'owner'", 'null': 'True', 'to': "orm['im.AstakosGroup']"}),
232
            'policy': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['im.Resource']", 'null': 'True', 'through': "orm['im.AstakosUserQuota']", 'symmetrical': 'False'}),
233
            'provider': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
234
            'third_party_identifier': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
235
            'updated': ('django.db.models.fields.DateTimeField', [], {}),
236
            'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'})
237
        },
238
        'im.astakosuserquota': {
239
            'Meta': {'unique_together': "(('resource', 'user'),)", 'object_name': 'AstakosUserQuota'},
240
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
241
            'limit': ('django.db.models.fields.PositiveIntegerField', [], {}),
242
            'resource': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.Resource']"}),
243
            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.AstakosUser']"})
244
        },
245
        'im.emailchange': {
246
            'Meta': {'object_name': 'EmailChange'},
247
            'activation_key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40', 'db_index': 'True'}),
248
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
249
            'new_email_address': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
250
            'requested_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2012, 8, 3, 11, 26, 47, 650373)'}),
251
            'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'emailchange_user'", 'unique': 'True', 'to': "orm['im.AstakosUser']"})
252
        },
253
        'im.groupkind': {
254
            'Meta': {'object_name': 'GroupKind'},
255
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
256
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255', 'db_index': 'True'})
257
        },
258
        'im.invitation': {
259
            'Meta': {'object_name': 'Invitation'},
260
            'code': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
261
            'consumed': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
262
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
263
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
264
            'inviter': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'invitations_sent'", 'null': 'True', 'to': "orm['im.AstakosUser']"}),
265
            'is_consumed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
266
            'realname': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
267
            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'})
268
        },
269
        'im.membership': {
270
            'Meta': {'unique_together': "(('person', 'group'),)", 'object_name': 'Membership'},
271
            'date_joined': ('django.db.models.fields.DateField', [], {'null': 'True', 'db_index': 'True'}),
272
            'date_requested': ('django.db.models.fields.DateField', [], {'default': 'datetime.datetime(2012, 8, 3, 11, 26, 47, 646518)'}),
273
            'group': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.AstakosGroup']"}),
274
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
275
            'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.AstakosUser']"})
276
        },
277
        'im.resource': {
278
            'Meta': {'object_name': 'Resource'},
279
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
280
            'meta': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['im.ResourceMetadata']", 'symmetrical': 'False'}),
281
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255', 'db_index': 'True'}),
282
            'service': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.Service']"})
283
        },
284
        'im.resourcemetadata': {
285
            'Meta': {'object_name': 'ResourceMetadata'},
286
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
287
            'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255', 'db_index': 'True'}),
288
            'value': ('django.db.models.fields.CharField', [], {'max_length': '255'})
289
        },
290
        'im.service': {
291
            'Meta': {'object_name': 'Service'},
292
            'auth_token': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
293
            'auth_token_created': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
294
            'auth_token_expires': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
295
            'icon': ('django.db.models.fields.FilePathField', [], {'max_length': '100', 'blank': 'True'}),
296
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
297
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255', 'db_index': 'True'}),
298
            'url': ('django.db.models.fields.FilePathField', [], {'max_length': '100'})
299
        }
300
    }
301

    
302
    complete_apps = ['im']