fix: Add database reference to replica/shard IDs and simplify templating
This MR add a {database}
macro to the ID of ReplicatedReplacingMergeTree references to avoid clashes between top level namespaces.
For good measure and future proofing these were also added to all inventory tables.
Additionally instead of referring to the table name twice in the template, the {table}
macro is used instead.