Skip to content

Commit 1ac9dc5

Browse files
committed
feat: add changelog tracking for representatives_meta_index table (closes #97)
1 parent ad96c8e commit 1ac9dc5

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

api/routes/accounts/index.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,9 @@ router.get('/:address', async (req, res) => {
9292
.where({ account: address })
9393
.orderBy('interval', 'asc')
9494

95-
const repMeta = await db('representatives_meta_index')
96-
.where({ account: address })
95+
const repMeta = await db('representatives_meta_index').where({
96+
account: address
97+
})
9798

9899
const network = await db('representatives_network')
99100
.where({ account: address })

db/schema.sql

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,23 @@ CREATE TABLE `representatives_meta_index` (
245245

246246
-- --------------------------------------------------------
247247

248+
--
249+
-- Table structure for table `representatives_meta_index_changelog`
250+
--
251+
252+
DROP TABLE IF EXISTS `representatives_meta_index_changelog`;
253+
254+
CREATE TABLE `representatives_meta_index_changelog` (
255+
`account` char(65) NOT NULL,
256+
`column` varchar(65) NOT NULL,
257+
`previous_value` text CHARACTER SET utf8mb4 DEFAULT '',
258+
`new_value` text CHARACTER SET utf8mb4 DEFAULT '',
259+
`timestamp` int(11) NOT NULL,
260+
UNIQUE `change` (`account`, `column`, `previous_value`(60), `new_value`(60))
261+
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;
262+
263+
-- --------------------------------------------------------
264+
248265
--
249266
-- Table structure for table `representatives_telemetry`
250267
--

0 commit comments

Comments
 (0)