diff options
| author | Zephyrrus <[email protected]> | 2021-01-07 21:36:56 +0200 |
|---|---|---|
| committer | Zephyrrus <[email protected]> | 2021-01-07 21:36:56 +0200 |
| commit | b3df1dd7a653909fb3f18ed7c0c91ffa347480fb (patch) | |
| tree | 785a168e85aa6ebe7e8e7e8ea4a3f54dbe3c7efc /src/api/structures | |
| parent | chore: update knex, mdi/font, nuxtjs/axios, nuxt, systeminformation (diff) | |
| download | host.fuwn.me-b3df1dd7a653909fb3f18ed7c0c91ffa347480fb.tar.xz host.fuwn.me-b3df1dd7a653909fb3f18ed7c0c91ffa347480fb.zip | |
feat: change mutation timestamp on every database mutation
Diffstat (limited to 'src/api/structures')
| -rw-r--r-- | src/api/structures/Database.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/api/structures/Database.js b/src/api/structures/Database.js index 3b256d3..5818452 100644 --- a/src/api/structures/Database.js +++ b/src/api/structures/Database.js @@ -1,5 +1,13 @@ const nodePath = require('path'); -const db = require('knex')({ +const Knex = require('knex'); + +// eslint-disable-next-line func-names +Knex.QueryBuilder.extend('wasMutated', function() { + this.client.config.userParams.lastMutationTime = Date.now(); + return this; +}); + +const db = Knex({ client: process.env.DB_CLIENT, connection: { host: process.env.DB_HOST, |