Skip to content

Commit

Permalink
Merge 5e72efc into c209e93
Browse files Browse the repository at this point in the history
  • Loading branch information
thraxil committed Jun 20, 2016
2 parents c209e93 + 5e72efc commit 962ee76
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
* migration to delete `TestBlock` if it exists (cleaning up an earlier
migration snafu)

1.2.0 (2016-05-27)
===================
* Added jshint/jscs checks
Expand Down
31 changes: 31 additions & 0 deletions pagetree/migrations/0002_delete_testblock.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations


class ConditionalDeleteModel(migrations.DeleteModel):
def database_forwards(self, app_label, schema_editor, from_state,
to_state):
try:
super(ConditionalDeleteModel, self).database_forwards(
self, app_label, schema_editor, from_state, to_state)
except:
""" if it fails, it's totally fine. it just means that the
table we wanted to delete doesn't exist. so we ignore it.
it would be nice to catch a more specific exception, but
different databases raise different ones..."""
pass


class Migration(migrations.Migration):

dependencies = [
('pagetree', '0001_initial'),
]

operations = [
ConditionalDeleteModel(
name='TestBlock',
),
]

0 comments on commit 962ee76

Please sign in to comment.