Currently query count auditing for aliased datum streams is accounted for on the target (source) stream. On invoices this means API requests for alias streams show up on the target stream. To support NET-176, we should filp this around and start accounting on the alias stream. This impacts at least these two core database functions:
- solardatm.audit_increment_datum_q_count which adds counts to the target stream currently, but would switch to the alias stream
- solarbill.billing_usage whose datum CTE currently joins on solardatm.da_datm_meta but would need to switch to solardatm.da_datm_meta_aliased to pick up aliased streams
After this change, invoices would attribute query counts on aliases to the alias node ID instead of the target node ID.