From 03ee20783b8d6052651e8856cac7f72b576fcf3b Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Wed, 6 Jul 2016 20:55:50 -0600 Subject: [PATCH 1/2] Enable FK's, duh --- core/database.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/database.js b/core/database.js index 924b60ed..f8b084e7 100644 --- a/core/database.js +++ b/core/database.js @@ -97,6 +97,9 @@ function initializeDatabases(cb) { } function createSystemTables() { + + dbs.system.run('PRAGMA foreign_keys = ON;'); + dbs.system.run( 'CREATE TABLE IF NOT EXISTS system_property (' + ' prop_name VARCHAR PRIMARY KEY NOT NULL,' + @@ -120,6 +123,8 @@ function createSystemTables() { } function createUserTables() { + dbs.user.run('PRAGMA foreign_keys = ON;'); + dbs.user.run( `CREATE TABLE IF NOT EXISTS user ( id INTEGER PRIMARY KEY, @@ -158,6 +163,9 @@ function createUserTables() { } function createMessageBaseTables() { + + dbs.message.run('PRAGMA foreign_keys = ON;'); + dbs.message.run( `CREATE TABLE IF NOT EXISTS message ( message_id INTEGER PRIMARY KEY, From 0519d9a001bb985c5fcdab771984027f8940d36b Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Wed, 6 Jul 2016 20:56:30 -0600 Subject: [PATCH 2/2] Minor cleanup, prevent XY from warning in log --- core/predefined_mci.js | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/core/predefined_mci.js b/core/predefined_mci.js index b8d7bbbc..10308581 100644 --- a/core/predefined_mci.js +++ b/core/predefined_mci.js @@ -1,17 +1,18 @@ /* jslint node: true */ 'use strict'; -var Config = require('./config.js').config; -var Log = require('./logger.js').log; -var getMessageAreaByTag = require('./message_area.js').getMessageAreaByTag; -var clientConnections = require('./client_connections.js'); -var sysProp = require('./system_property.js'); +// ENiGMA½ +const Config = require('./config.js').config; +const Log = require('./logger.js').log; +const getMessageAreaByTag = require('./message_area.js').getMessageAreaByTag; +const clientConnections = require('./client_connections.js'); +const sysProp = require('./system_property.js'); -var packageJson = require('../package.json'); -var assert = require('assert'); -var os = require('os'); -var _ = require('lodash'); -var moment = require('moment'); +// deps +const packageJson = require('../package.json'); +const os = require('os'); +const _ = require('lodash'); +const moment = require('moment'); exports.getPredefinedMCIValue = getPredefinedMCIValue; @@ -68,10 +69,10 @@ function getPredefinedMCIValue(client, code) { return area ? area.name : ''; }, - ML : function messageAreaDescription() { - const area = getMessageAreaByTag(client.user.properties.message_area_tag); - return area ? area.desc : ''; - }, + ML : function messageAreaDescription() { + const area = getMessageAreaByTag(client.user.properties.message_area_tag); + return area ? area.desc : ''; + }, SH : function termHeight() { return client.term.termHeight.toString(); }, SW : function termWidth() { return client.term.termWidth.toString(); }, @@ -113,6 +114,11 @@ function getPredefinedMCIValue(client, code) { AN : function activeNodes() { return clientConnections.getActiveConnections().length.toString(); }, TC : function totalCalls() { return sysProp.getSystemProperty('login_count').toString(); }, + + // + // Special handling for XY + // + XY : function xyHack() { return; /* nothing */ }, }[code](); // :TODO: Just call toString() here and remove above - DRY