Downsampling all data exported from prometheus

Hi
I’m new to Influxdb. I’m collecting all metrics using remote read and write api from prometheus to Influxdb.
I can create CQs or TICKscript for downsample one metric. The problem is there is lots of metrics and I can’t create TICKscript for downsampling all of theme.
How I can Downsample all metrics in new database?

I find the solution
This kind of tasks should be done with CQs or TICKscript in kapacitor.
trying to solve this problem with regex, but I found out they don’t provide regex support for TICKscript because it is slow. however if you don’t specify any measurement, automatically all measurements will be selected for downsampling. My simple TICKscript is like this:

stream
    |from()
        .database('oldDB')
        .groupBy(*)
    |window()
        .period(10m)
        .every(10m)
        .align()
    |mean('value')
        .as('value')
    |influxDBOut()
        .database('newDB')
        .retentionPolicy('default')
        .precision('s')