@@ -0,0 +1,1569 @@
+# coding=utf-8%0A%22%22%22fix identifier prefix%0A%0ARevision ID: %0ARevises: %0ACreate Date: 2014-10-24 10:59:01.044000%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0A%0Arevision = ''%0Adown_revision = ''%0A%0Aimport datetime%0A%0Afrom alembic import op%0Aimport sqlalchemy as sa%0A%0A%0Adef upgrade():%0A    strip_prefix = sa.text('UPDATE identifier AS i SET updated = now(), '%0A        'name = substring(name from :extract) '%0A        'WHERE name LIKE :match AND NOT EXISTS ('%0A            'SELECT 1 FROM identifier WHERE type = i.type '%0A            'AND description = i.description AND lang = i.lang '%0A            'AND name = substring(i.name from :extract))', conn)%0A%0A    del_prefixed = sa.text('DELETE FROM identifier AS i '%0A        'WHERE name LIKE :match AND EXISTS ('%0A            'SELECT 1 FROM identifier WHERE type = i.type '%0A            'AND description = i.description AND lang = i.lang '%0A            'AND name = substring(i.name from :extract))', conn)%0A%0A    del_prefixed_langident = sa.text('DELETE FROM languageidentifier AS li '%0A        'WHERE EXISTS (SELECT 1 FROM identifier AS i '%0A            'WHERE pk = li.identifier_pk AND name LIKE :match AND EXISTS ('%0A                'SELECT 1 FROM identifier WHERE type = i.type '%0A                'AND description = i.description AND lang = i.lang '%0A                'AND name = substring(i.name from :extract)))', conn)%0A    %0A    for match, extract in %5B(': %25', ':%5Cs+(.*)'), ('L:%25', 'L:(.*)')%5D:%0A        for query in %5Bstrip_prefix, del_prefixed_langident, del_prefixed%5D:%0A            query.execute(match=match, extract=extract)%0A%0A%0Adef downgrade():%0A    pass%0A

work on alt name prefix strip migration