migrations off for dry runs
parent
7affe92c8d
commit
61b81219cb
|
@ -22,29 +22,30 @@ class Migration(SchemaMigration):
|
||||||
db.create_unique('core_identifier', ['type', 'value'])
|
db.create_unique('core_identifier', ['type', 'value'])
|
||||||
|
|
||||||
# migrating data
|
# migrating data
|
||||||
for work in orm.Work.objects.all():
|
if not db.dry_run:
|
||||||
if work.librarything_id:
|
for work in orm.Work.objects.all():
|
||||||
identifier = orm.Identifier.objects.create(type='ltwk',value=work.librarything_id, work=work)
|
if work.librarything_id:
|
||||||
identifier.save()
|
identifier = orm.Identifier.objects.create(type='ltwk',value=work.librarything_id, work=work)
|
||||||
if work.openlibrary_id:
|
|
||||||
identifier = orm.Identifier.objects.create(type='olwk',value=work.openlibrary_id, work=work)
|
|
||||||
identifier.save()
|
|
||||||
for edition in work.editions.all():
|
|
||||||
if edition.googlebooks_id:
|
|
||||||
identifier = orm.Identifier.objects.create(type='goog',value=edition.googlebooks_id, work=work, edition=edition)
|
|
||||||
identifier.save()
|
identifier.save()
|
||||||
if edition.goodreads_id:
|
if work.openlibrary_id:
|
||||||
identifier = orm.Identifier.objects.create(type='gdrd',value=edition.goodreads_id, work=work, edition=edition)
|
identifier = orm.Identifier.objects.create(type='olwk',value=work.openlibrary_id, work=work)
|
||||||
identifier.save()
|
|
||||||
if edition.librarything_id:
|
|
||||||
identifier = orm.Identifier.objects.create(type='thng',value=edition.librarything_id, work=work, edition=edition)
|
|
||||||
identifier.save()
|
|
||||||
if edition.isbn_13:
|
|
||||||
identifier = orm.Identifier.objects.create(type='isbn',value=edition.isbn_13, work=work, edition=edition)
|
|
||||||
identifier.save()
|
|
||||||
if edition.oclc:
|
|
||||||
identifier = orm.Identifier.objects.create(type='oclc',value=edition.oclc, work=work, edition=edition)
|
|
||||||
identifier.save()
|
identifier.save()
|
||||||
|
for edition in work.editions.all():
|
||||||
|
if edition.googlebooks_id:
|
||||||
|
identifier = orm.Identifier.objects.create(type='goog',value=edition.googlebooks_id, work=work, edition=edition)
|
||||||
|
identifier.save()
|
||||||
|
if edition.goodreads_id:
|
||||||
|
identifier = orm.Identifier.objects.create(type='gdrd',value=edition.goodreads_id, work=work, edition=edition)
|
||||||
|
identifier.save()
|
||||||
|
if edition.librarything_id:
|
||||||
|
identifier = orm.Identifier.objects.create(type='thng',value=edition.librarything_id, work=work, edition=edition)
|
||||||
|
identifier.save()
|
||||||
|
if edition.isbn_13:
|
||||||
|
identifier = orm.Identifier.objects.create(type='isbn',value=edition.isbn_13, work=work, edition=edition)
|
||||||
|
identifier.save()
|
||||||
|
if edition.oclc:
|
||||||
|
identifier = orm.Identifier.objects.create(type='oclc',value=edition.oclc, work=work, edition=edition)
|
||||||
|
identifier.save()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -54,28 +54,30 @@ 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
|
||||||
for identifier in orm.Identifier.objects.all():
|
if not db.dry_run:
|
||||||
if identifier.type=='ltwk':
|
|
||||||
identifier.work.librarything_id = identifier.value
|
for identifier in orm.Identifier.objects.all():
|
||||||
identifier.work.save()
|
if identifier.type=='ltwk':
|
||||||
elif identifier.type=='olwk':
|
identifier.work.librarything_id = identifier.value
|
||||||
identifier.work.openlibrary_id = identifier.value
|
identifier.work.save()
|
||||||
identifier.work.save()
|
elif identifier.type=='olwk':
|
||||||
elif identifier.type=='goog':
|
identifier.work.openlibrary_id = identifier.value
|
||||||
identifier.edition.googlebooks_id = identifier.value
|
identifier.work.save()
|
||||||
identifier.edition.save()
|
elif identifier.type=='goog':
|
||||||
elif identifier.type=='gdrd':
|
identifier.edition.googlebooks_id = identifier.value
|
||||||
identifier.edition.goodreads_id = identifier.value
|
identifier.edition.save()
|
||||||
identifier.edition.save()
|
elif identifier.type=='gdrd':
|
||||||
elif identifier.type=='thng':
|
identifier.edition.goodreads_id = identifier.value
|
||||||
identifier.edition.librarything_id = identifier.value
|
identifier.edition.save()
|
||||||
identifier.edition.save()
|
elif identifier.type=='thng':
|
||||||
elif identifier.type=='isbn':
|
identifier.edition.librarything_id = identifier.value
|
||||||
identifier.edition.isbn_13 = identifier.value
|
identifier.edition.save()
|
||||||
identifier.edition.save()
|
elif identifier.type=='isbn':
|
||||||
elif identifier.type=='oclc':
|
identifier.edition.isbn_13 = identifier.value
|
||||||
identifier.edition.oclc = identifier.value
|
identifier.edition.save()
|
||||||
identifier.edition.save()
|
elif identifier.type=='oclc':
|
||||||
|
identifier.edition.oclc = identifier.value
|
||||||
|
identifier.edition.save()
|
||||||
|
|
||||||
|
|
||||||
models = {
|
models = {
|
||||||
|
|
Loading…
Reference in New Issue