The CQ database’s schema needs to be versioned in order to detect when changes are made to it.
One solution is to add a metadata table (with name and value columns) to the database and use it to store the current schema version, and provide a tools/cq_upgrade.py utility to then check versions and upgrade when needed. This is similar to what is done in mapknowledge/init.py for knowledgebase.db.
The schema version should also be a constant in the map server's competency_query.py so that it can detect and warn when a schema upgrade is needed, instead of giving missing table errors.