def _upgrade_to_0dot3(self, db):
        cursor = db.cursor()
        cursor.execute("ALTER TABLE asa_artifact_wiki RENAME TO asa_artifact_wiki_references;")
        for table in schema: # TODO: fix. reference to global var
            if table.name == "asa_artifact_artifact_references":
                self._create_table(table, cursor)
                break

        from AdaptiveArtifacts.persistence.data import DBPool
        from AdaptiveArtifacts.model.pool import InstancePool
        from AdaptiveArtifacts.model.core import Instance
        dbp = DBPool(self.env, InstancePool())
        dbp.load_specs()
        dbp.load_artifacts_of(Instance.get_name())
        for artifact in dbp.pool.get_instances_of(Instance.get_name()):
            dbp.update_artifact_ref_count(artifact, db)

        cursor.execute("UPDATE system SET value='0.3' WHERE name='%s'" % (self.db_key,))
        self.log.info('Upgraded ASA tables from versions 0.1/0.2 to 0.3')
    def _upgrade_to_0dot3(self, db):
        cursor = db.cursor()
        cursor.execute(
            "ALTER TABLE asa_artifact_wiki RENAME TO asa_artifact_wiki_references;"
        )
        for table in schema:  # TODO: fix. reference to global var
            if table.name == "asa_artifact_artifact_references":
                self._create_table(table, cursor)
                break

        from AdaptiveArtifacts.persistence.data import DBPool
        from AdaptiveArtifacts.model.pool import InstancePool
        from AdaptiveArtifacts.model.core import Instance
        dbp = DBPool(self.env, InstancePool())
        dbp.load_specs()
        dbp.load_artifacts_of(Instance.get_name())
        for artifact in dbp.pool.get_instances_of(Instance.get_name()):
            dbp.update_artifact_ref_count(artifact, db)

        cursor.execute("UPDATE system SET value='0.3' WHERE name='%s'" %
                       (self.db_key, ))
        self.log.info('Upgraded ASA tables from versions 0.1/0.2 to 0.3')