diff --git a/WHATSNEW.md b/WHATSNEW.md index ee0e4943..057ff329 100644 --- a/WHATSNEW.md +++ b/WHATSNEW.md @@ -14,6 +14,7 @@ This document attempts to track **major** changes and additions in ENiGMA½. For * File base search has had an improvement to search term handling. * `./oputil user group -group` to now accepts `~group` removing the need for special handling of the "-" character. #331 * A fix has been made to clean up old `file.db` entries when a file is removed. Previously stale records could be left or even recycled into new entries. Please see [UPGRADE.md](UPGRADE.md) for details on applying this fix (look for `tables_update_2020-11-29.sql`). +* The [./docs/modding/onelinerz.md](onelinerz) module can have `dbSuffix` set in it's `config` block to specify a separate DB file. For example to use as a requests list. ## 0.0.11-beta * Upgraded from `alpha` to `beta` -- The software is far along and mature enough at this point! diff --git a/core/onelinerz.js b/core/onelinerz.js index d840f731..679f5fec 100644 --- a/core/onelinerz.js +++ b/core/onelinerz.js @@ -135,7 +135,7 @@ exports.getModule = class OnelinerzModule extends MenuModule { self.db.each( `SELECT * FROM ( - SELECT * + SELECT * FROM onelinerz ORDER BY timestamp DESC LIMIT ${limit} @@ -248,8 +248,9 @@ exports.getModule = class OnelinerzModule extends MenuModule { async.series( [ function openDatabase(callback) { + const dbSuffix = self.menuConfig.config.dbSuffix; self.db = getTransactionDatabase(new sqlite3.Database( - getModDatabasePath(exports.moduleInfo), + getModDatabasePath(exports.moduleInfo, dbSuffix), err => { return callback(err); } @@ -260,7 +261,7 @@ exports.getModule = class OnelinerzModule extends MenuModule { `CREATE TABLE IF NOT EXISTS onelinerz ( id INTEGER PRIMARY KEY, user_id INTEGER_NOT NULL, - user_name VARCHAR NOT NULL, + user_name VARCHAR NOT NULL, oneliner VARCHAR NOT NULL, timestamp DATETIME NOT NULL );` diff --git a/docs/modding/onelinerz.md b/docs/modding/onelinerz.md index 92515617..001c4e04 100644 --- a/docs/modding/onelinerz.md +++ b/docs/modding/onelinerz.md @@ -9,6 +9,7 @@ The built in `onelinerz` module provides a retro onelinerz system. ### Config Block Available `config` block entries: * `dateTimeFormat`: [moment.js](https://momentjs.com) style format. Defaults to current theme → system `short` date format. +* `dbSuffix`: Provide a suffix that will be appended to the DB name to use onelinerz for more than one purpose (separate lists). ### Theming The following `itemFormat` object is provided to MCI 1 (ie: `%VM1`):