Statistics
| Branch: | Tag: | Revision:

root / snf-cyclades-app / synnefo / ui / userdata / migrations / 0003_auto__chg_field_publickeypair_fingerprint__chg_field_publickeypair_use.py @ e17979fe

History | View | Annotate | Download (2.1 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
        # Changing field 'PublicKeyPair.fingerprint'
12
        db.alter_column('userdata_publickeypair', 'fingerprint', self.gf('django.db.models.fields.CharField')(max_length=100, blank=True))
13

    
14
        # Renaming column for 'PublicKeyPair.user' to match new field type.
15
        db.rename_column('userdata_publickeypair', 'user_id', 'user')
16
        # Changing field 'PublicKeyPair.user'
17
        db.alter_column('userdata_publickeypair', 'user', self.gf('django.db.models.fields.CharField')(max_length=100))
18

    
19
        # Removing index on 'PublicKeyPair', fields ['user']
20
        try:
21
            db.delete_index('userdata_publickeypair', ['user_id'])
22
        except:
23
            pass
24

    
25

    
26
    def backwards(self, orm):
27

    
28
        # Changing field 'PublicKeyPair.fingerprint'
29
        db.alter_column('userdata_publickeypair', 'fingerprint', self.gf('django.db.models.fields.CharField')(max_length=100))
30

    
31
        # Renaming column for 'PublicKeyPair.user' to match new field type.
32
        db.rename_column('userdata_publickeypair', 'user', 'user_id')
33
        # Changing field 'PublicKeyPair.user'
34
        db.alter_column('userdata_publickeypair', 'user_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['db.SynnefoUser']))
35

    
36
        # Adding index on 'PublicKeyPair', fields ['user']
37
        db.create_index('userdata_publickeypair', ['user_id'])
38

    
39

    
40
    models = {
41
        'userdata.publickeypair': {
42
            'Meta': {'object_name': 'PublicKeyPair'},
43
            'content': ('django.db.models.fields.TextField', [], {}),
44
            'fingerprint': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
45
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
46
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
47
            'user': ('django.db.models.fields.CharField', [], {'max_length': '100'})
48
        }
49
    }
50

    
51
    complete_apps = ['userdata']