Allow suffix on onelinerz DB name

This commit is contained in:
Bryan Ashby 2020-12-07 19:53:49 -07:00
parent 6ad33c2de7
commit b579d966b6
No known key found for this signature in database
GPG Key ID: B49EB437951D2542
3 changed files with 6 additions and 3 deletions

View File

@ -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!

View File

@ -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
);`

View File

@ -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`):