Enable FK's, duh

This commit is contained in:
Bryan Ashby 2016-07-06 20:55:50 -06:00
parent 3bbdd4abae
commit 03ee20783b
1 changed files with 8 additions and 0 deletions

View File

@ -97,6 +97,9 @@ function initializeDatabases(cb) {
} }
function createSystemTables() { function createSystemTables() {
dbs.system.run('PRAGMA foreign_keys = ON;');
dbs.system.run( dbs.system.run(
'CREATE TABLE IF NOT EXISTS system_property (' + 'CREATE TABLE IF NOT EXISTS system_property (' +
' prop_name VARCHAR PRIMARY KEY NOT NULL,' + ' prop_name VARCHAR PRIMARY KEY NOT NULL,' +
@ -120,6 +123,8 @@ function createSystemTables() {
} }
function createUserTables() { function createUserTables() {
dbs.user.run('PRAGMA foreign_keys = ON;');
dbs.user.run( dbs.user.run(
`CREATE TABLE IF NOT EXISTS user ( `CREATE TABLE IF NOT EXISTS user (
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,
@ -158,6 +163,9 @@ function createUserTables() {
} }
function createMessageBaseTables() { function createMessageBaseTables() {
dbs.message.run('PRAGMA foreign_keys = ON;');
dbs.message.run( dbs.message.run(
`CREATE TABLE IF NOT EXISTS message ( `CREATE TABLE IF NOT EXISTS message (
message_id INTEGER PRIMARY KEY, message_id INTEGER PRIMARY KEY,