diff --git a/api/routes/accounts/index.mjs b/api/routes/accounts/index.mjs index 05afcd14..71ddf863 100644 --- a/api/routes/accounts/index.mjs +++ b/api/routes/accounts/index.mjs @@ -92,7 +92,7 @@ router.get('/:address', async (req, res) => { .orderBy('timestamp', 'desc') .limit(1) - const uptime = await db('representatives_uptime_rollup_2hour') + const uptime = await db('representatives_uptime_rollup_hour') .where({ account: address }) .orderBy('interval', 'asc') diff --git a/api/routes/representatives/index.mjs b/api/routes/representatives/index.mjs index 26d57ee9..daee434c 100644 --- a/api/routes/representatives/index.mjs +++ b/api/routes/representatives/index.mjs @@ -30,7 +30,7 @@ const loadRepresentatives = async () => { accounts ) - const uptime = db('representatives_uptime_rollup_2hour') + const uptime = db('representatives_uptime_rollup_hour') .whereIn('account', accounts) .orderBy('interval', 'asc') diff --git a/db/schema.sql b/db/schema.sql index 6bf45d3f..87eaec06 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -534,9 +534,9 @@ CREATE TABLE `representatives_uptime_summary` ( -- Table structure for table `representatives_uptime` -- -DROP TABLE IF EXISTS `representatives_uptime_rollup_2hour`; +DROP TABLE IF EXISTS `representatives_uptime_rollup_hour`; -CREATE TABLE `representatives_uptime_rollup_2hour` ( +CREATE TABLE `representatives_uptime_rollup_hour` ( `account` char(65) NOT NULL, `online` tinyint(1) NOT NULL, diff --git a/scripts/import-uptime.mjs b/scripts/import-uptime.mjs index c7d6e7bf..fbc63616 100644 --- a/scripts/import-uptime.mjs +++ b/scripts/import-uptime.mjs @@ -166,7 +166,7 @@ const importUptime = async () => { if (inserts.length) { logger(`saving ${inserts.length} rollups for ${account}`) - await db('representatives_uptime_rollup_2hour') + await db('representatives_uptime_rollup_hour') .insert(inserts) .onConflict() .merge() @@ -174,7 +174,7 @@ const importUptime = async () => { } // remove rows for representatives without uptime in the last 14 days - const res = await db('representatives_uptime_rollup_2hour') + const res = await db('representatives_uptime_rollup_hour') .whereNotIn('account', Object.keys(grouped)) .delete()