1
0

Enable foreign_keys for SQLite. Add unique location id to records.

This commit is contained in:
2018-05-23 01:27:30 +02:00
parent 800e4d9b06
commit 64cad5adcb
3 changed files with 3 additions and 0 deletions

View File

@ -10,6 +10,7 @@ class SQLite extends AbstractDatabase
{
$this->db = new \PDO('sqlite:' . $db);
$this->prefix = '';
$this->execute('PRAGMA foreign_keys = ON;');
}
protected function query(string $sql, array $params = array()): array

View File

@ -1,4 +1,5 @@
CREATE TABLE `locations` (
`lid` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`accuracy` int(11) DEFAULT NULL,
`altitude` int(11) DEFAULT NULL,

View File

@ -1,6 +1,7 @@
PRAGMA journal_mode=WAL;
CREATE TABLE "locations" (
"lid" INTEGER PRIMARY KEY AUTOINCREMENT,
"dt" INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP,
"accuracy" INTEGER,
"altitude" INTEGER,