generate constant ids per org

Requieres sql changes found in update_constant_tables.sql