[migration/fix] the asource column might still be prevent at this point

When doing a migration from a very old project to the latest CW (3.26) this part of the migration failed because 'entities.asource' wasn't removed yet thus breaking this part of the migration. Removing it fix it but ... it might not be the prettiest fix.

authorLaurent Peuch <cortex@worlddomination.be>
changeset3a70e0c51c64
branchdefault
phasedraft
hiddenno
parent revision#a4d465a3e77d fix(ci): manually remove the .tox/doc directory
child revision<not specified>
files modified by this revision
cubicweb/misc/migration/bootstrapmigration_repository.py
# HG changeset patch
# User Laurent Peuch <cortex@worlddomination.be>
# Date 1557421084 -7200
# Thu May 09 18:58:04 2019 +0200
# Node ID 3a70e0c51c640a847b374531d72c757ae24e11d2
# Parent a4d465a3e77d07cf6a79c121c10b2d6484cd7468
[migration/fix] the asource column might still be prevent at this point

When doing a migration from a very old project to the latest CW (3.26) this
part of the migration failed because 'entities.asource' wasn't removed yet thus
breaking this part of the migration. Removing it fix it but ... it might not be
the prettiest fix.

diff --git a/cubicweb/misc/migration/bootstrapmigration_repository.py b/cubicweb/misc/migration/bootstrapmigration_repository.py
@@ -374,10 +374,14 @@
1 
2  if applcubicwebversion < (3, 2, 0) and cubicwebversion >= (3, 2, 0):
3      add_cube('card', update_database=False)
4 
5  if applcubicwebversion < (3, 20, 0) and cubicwebversion >= (3, 20, 0):
6 +    try:
7 +        sql('ALTER TABLE entities DROP COLUMN asource')
8 +    except Exception:  # the 'if exists' close of drop column if not universal to all dbs
9 +        pass
10      ss._IGNORED_PROPS.append('formula')
11      add_attribute('CWAttribute', 'formula', commit=False)
12      ss._IGNORED_PROPS.remove('formula')
13      commit()
14      add_entity_type('CWComputedRType')