misc/migration/3.21.0_Any.py
author Julien Cristau <julien.cristau@logilab.fr>
Mon, 18 May 2015 16:44:49 +0200
changeset 10439 45e18b4a7466
parent 10371 88577b10b31e
child 10448 de5be53e2ea8
permissions -rw-r--r--
[devtools] change the way we start/stop postgresql Instead of having the test db handler start a cluster on demand, use the test module's setUp/tearDown callbacks to do it. This allows to have one data directory (and thus cluster) per test module, allowing different test modules to run in parallel, each using its own database cluster whose path is based on the test module.


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()

sync_schema_props_perms('CWEType')

sync_schema_props_perms('cwuri')