From: Radek Czajka Date: Wed, 26 May 2010 10:43:54 +0000 (+0200) Subject: migration fix X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/b77e2d24f4759d6540f20627fd4c70f7d7abcd97?ds=inline migration fix --- diff --git a/apps/sponsors/migrations/0001_initial.py b/apps/sponsors/migrations/0001_initial.py index 35eebaa6d..5721bcc72 100644 --- a/apps/sponsors/migrations/0001_initial.py +++ b/apps/sponsors/migrations/0001_initial.py @@ -9,7 +9,7 @@ class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Sponsor' - db.mock_model('sponsors_sponsor', ( + db.create_table('sponsors_sponsor', ( ('url', self.gf('django.db.models.fields.URLField')(max_length=200, blank=True)), ('logo', self.gf('django.db.models.fields.files.ImageField')(max_length=100)), ('_description', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)), @@ -19,7 +19,7 @@ class Migration(SchemaMigration): db.send_create_signal('sponsors', ['Sponsor']) # Adding model 'SponsorPage' - db.mock_model('sponsors_sponsorpage', ( + db.create_table('sponsors_sponsorpage', ( ('_html', self.gf('django.db.models.fields.TextField')(blank=True)), ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('sponsors', self.gf('sponsors.fields.JSONField')(default={})), diff --git a/apps/sponsors/migrations/0002_move_path.py b/apps/sponsors/migrations/0002_move_path.py index 1afbd540c..1f3819e6a 100644 --- a/apps/sponsors/migrations/0002_move_path.py +++ b/apps/sponsors/migrations/0002_move_path.py @@ -10,8 +10,12 @@ from os import path def move_sponsors_media(orm, old, new): - move(path.join(settings.MEDIA_ROOT, old), - path.join(settings.MEDIA_ROOT, new)) + try: + move(path.join(settings.MEDIA_ROOT, old), + path.join(settings.MEDIA_ROOT, new)) + except IOError: + # there could be no sponsors directory yet + pass for sponsor in orm.Sponsor.objects.all(): base, rest = sponsor.logo.name.split('/', 1) sponsor.logo.name = '/'.join((new, rest))