migrations off for dry runs

pull/1/head
eric 2012-01-16 13:31:12 -05:00
parent 7affe92c8d
commit 61b81219cb
2 changed files with 46 additions and 43 deletions

View File

@ -22,6 +22,7 @@ class Migration(SchemaMigration):
db.create_unique('core_identifier', ['type', 'value']) db.create_unique('core_identifier', ['type', 'value'])
# migrating data # migrating data
if not db.dry_run:
for work in orm.Work.objects.all(): for work in orm.Work.objects.all():
if work.librarything_id: if work.librarything_id:
identifier = orm.Identifier.objects.create(type='ltwk',value=work.librarything_id, work=work) identifier = orm.Identifier.objects.create(type='ltwk',value=work.librarything_id, work=work)

View File

@ -54,6 +54,8 @@ class Migration(SchemaMigration):
db.add_column('core_edition', 'librarything_id', self.gf('django.db.models.fields.CharField')(max_length=50, null=True), keep_default=False) db.add_column('core_edition', 'librarything_id', self.gf('django.db.models.fields.CharField')(max_length=50, null=True), keep_default=False)
# migrating data # migrating data
if not db.dry_run:
for identifier in orm.Identifier.objects.all(): for identifier in orm.Identifier.objects.all():
if identifier.type=='ltwk': if identifier.type=='ltwk':
identifier.work.librarything_id = identifier.value identifier.work.librarything_id = identifier.value