Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
72904b1d
Commit
72904b1d
authored
Mar 05, 2012
by
Kostas Papadimitriou
Browse files
Fixed userdata migration
Catch attempt to delete inexistent key
parent
5dcb8d04
Changes
1
Hide whitespace changes
Inline
Side-by-side
snf-cyclades-app/synnefo/ui/userdata/migrations/0003_auto__chg_field_publickeypair_fingerprint__chg_field_publickeypair_use.py
View file @
72904b1d
...
...
@@ -5,9 +5,9 @@ from south.v2 import SchemaMigration
from
django.db
import
models
class
Migration
(
SchemaMigration
):
def
forwards
(
self
,
orm
):
# Changing field 'PublicKeyPair.fingerprint'
db
.
alter_column
(
'userdata_publickeypair'
,
'fingerprint'
,
self
.
gf
(
'django.db.models.fields.CharField'
)(
max_length
=
100
,
blank
=
True
))
...
...
@@ -17,11 +17,14 @@ class Migration(SchemaMigration):
db
.
alter_column
(
'userdata_publickeypair'
,
'user'
,
self
.
gf
(
'django.db.models.fields.CharField'
)(
max_length
=
100
))
# Removing index on 'PublicKeyPair', fields ['user']
db
.
delete_index
(
'userdata_publickeypair'
,
[
'user_id'
])
try
:
db
.
delete_index
(
'userdata_publickeypair'
,
[
'user_id'
])
except
:
pass
def
backwards
(
self
,
orm
):
# Changing field 'PublicKeyPair.fingerprint'
db
.
alter_column
(
'userdata_publickeypair'
,
'fingerprint'
,
self
.
gf
(
'django.db.models.fields.CharField'
)(
max_length
=
100
))
...
...
@@ -32,8 +35,8 @@ class Migration(SchemaMigration):
# Adding index on 'PublicKeyPair', fields ['user']
db
.
create_index
(
'userdata_publickeypair'
,
[
'user_id'
])
models
=
{
'userdata.publickeypair'
:
{
'Meta'
:
{
'object_name'
:
'PublicKeyPair'
},
...
...
@@ -44,5 +47,5 @@ class Migration(SchemaMigration):
'user'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'100'
})
}
}
complete_apps
=
[
'userdata'
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment