From 0f69216d66d247a33bc82f639f8fac979de0de9e Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 11 Aug 2021 10:59:27 +0545 Subject: [PATCH] collection for usage stats --- app/config/collections2.php | 78 +++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/app/config/collections2.php b/app/config/collections2.php index ae9a4feeb1..ce9f4374ec 100644 --- a/app/config/collections2.php +++ b/app/config/collections2.php @@ -1403,6 +1403,84 @@ $collections = [ ], ], ], + 'stats' => [ + '$collection' => Database::COLLECTIONS, + '$id' => 'stats', + 'name' => 'Stats', + 'attributes' => [ + [ + '$id' => 'metric', + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 255, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => 'value', + 'type' => Database::VAR_INTEGER, + 'format' => '', + 'size' => 0, + 'signed' => false, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => 'time', + 'type' => Database::VAR_INTEGER, + 'format' => '', + 'size' => 0, + 'signed' => false, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => 'period', + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 4, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => 'type', + 'type' => Database::VAR_INTEGER, + 'format' => '', + 'size' => 1, + 'signed' => false, + 'required' => true, + 'default' => 0, // 0 -> count, 1 -> sum + 'array' => false, + 'filters' => [], + ], + ], + 'indexes' => [ + [ + '$id' => '_key_time', + 'type' => Database::INDEX_KEY, + 'attributes' => ['time'], + 'lengths' => [100], + 'orders' => [Database::ORDER_DESC], + ], + [ + '$id' => '_key_time_period', + 'type' => Database::INDEX_KEY, + 'attributes' => ['time', 'period'], + 'lengths' => [100, 4], + 'orders' => [Database::ORDER_DESC], + ], + ], + ] ]; return $collections;