misc/migration/3.21.0_Any.py
author Denis Laxalde <denis.laxalde@logilab.fr>
Wed, 25 Mar 2015 10:10:24 +0100
changeset 10276 ffb269e60348
parent 10209 4c64a41c0a1d
child 10316 4ce8b8437838
permissions -rw-r--r--
[web/request] Restore attribute setting for search_state This was dropped in 1f84295bfe95 when `search_state` attribute was turned into a property, but without a setter. So adding a setter here restoring previous behaviour, as some tests and cubes use it. Related to #4875761.


helper = repo.system_source.dbhelper
sql('DROP INDEX entities_extid_idx')
sql(helper.sql_create_index('entities', 'extid', True))

sql('''
CREATE TABLE moved_entities (
  eid INTEGER PRIMARY KEY NOT NULL,
  extid VARCHAR(256) UNIQUE
)
''')

moved_entities = sql('SELECT -eid, extid FROM entities WHERE eid < 0')
cu = session.cnxset.cu
cu.executemany('INSERT INTO moved_entities (eid, extid) VALUES (%s, %s)',
               moved_entities)
sql('DELETE FROM entities WHERE eid < 0')

commit()