Enable foreign_keys for SQLite. Add unique location id to records.
This commit is contained in:
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
Reference in New Issue
Block a user