mirror of
https://github.com/mbirth/tcl_update_db.git
synced 2024-12-26 12:34:07 +00:00
Move fv and tv into files table.
This commit is contained in:
parent
c675eeacbf
commit
6d8f3bda7b
@ -14,6 +14,7 @@ class SQLiteWriter
|
|||||||
if ($this->pdo === false) {
|
if ($this->pdo === false) {
|
||||||
return $sqlerror;
|
return $sqlerror;
|
||||||
}
|
}
|
||||||
|
$this->pdo->exec('PRAGMA foreign_keys=on;');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function insertArray($table, $data, $replace = false)
|
private function insertArray($table, $data, $replace = false)
|
||||||
@ -75,6 +76,8 @@ class SQLiteWriter
|
|||||||
'sha1' => $file_arr['file_sha1'],
|
'sha1' => $file_arr['file_sha1'],
|
||||||
'file_name' => $file_arr['file_name'],
|
'file_name' => $file_arr['file_name'],
|
||||||
'file_size' => $file_arr['file_size'],
|
'file_size' => $file_arr['file_size'],
|
||||||
|
'fv' => $file_arr['fv'],
|
||||||
|
'tv' => $file_arr['tv'],
|
||||||
'type' => $file_arr['type'],
|
'type' => $file_arr['type'],
|
||||||
'note' => json_encode($note, JSON_UNESCAPED_UNICODE),
|
'note' => json_encode($note, JSON_UNESCAPED_UNICODE),
|
||||||
'published_first' => $pubFirst,
|
'published_first' => $pubFirst,
|
||||||
@ -90,6 +93,8 @@ class SQLiteWriter
|
|||||||
'file_name' => $g->filename,
|
'file_name' => $g->filename,
|
||||||
'file_size' => $g->file_size,
|
'file_size' => $g->file_size,
|
||||||
'type' => $g->type,
|
'type' => $g->type,
|
||||||
|
'fv' => $g->fv,
|
||||||
|
'tv' => $g->tv,
|
||||||
'note' => array(
|
'note' => array(
|
||||||
'en' => $g->description_en,
|
'en' => $g->description_en,
|
||||||
'ja' => $g->description_ja,
|
'ja' => $g->description_ja,
|
||||||
@ -98,8 +103,6 @@ class SQLiteWriter
|
|||||||
'pubDate' => $g->time,
|
'pubDate' => $g->time,
|
||||||
));
|
));
|
||||||
$ok = $this->insertArray('updates', array(
|
$ok = $this->insertArray('updates', array(
|
||||||
'tv' => $g->tv,
|
|
||||||
'fv' => $g->fv,
|
|
||||||
'svn' => $g->svn,
|
'svn' => $g->svn,
|
||||||
'pubDate' => $g->time,
|
'pubDate' => $g->time,
|
||||||
'publisher' => $g->publisher,
|
'publisher' => $g->publisher,
|
||||||
|
@ -43,6 +43,8 @@ CREATE TABLE "files" (
|
|||||||
"file_name" TEXT, -- filename of file
|
"file_name" TEXT, -- filename of file
|
||||||
"file_size" INTEGER, -- size
|
"file_size" INTEGER, -- size
|
||||||
"type" TEXT, -- FULL(4) or OTA(2) update
|
"type" TEXT, -- FULL(4) or OTA(2) update
|
||||||
|
"fv" TEXT, -- from version (only for OTA)
|
||||||
|
"tv" TEXT, -- target version, e.g. AAQ302
|
||||||
"note" TEXT, -- description of file (optional)
|
"note" TEXT, -- description of file (optional)
|
||||||
"published_first" INTEGER, -- stamp of earliest pubdate
|
"published_first" INTEGER, -- stamp of earliest pubdate
|
||||||
"published_last" INTEGER -- stamp of latest pubdate
|
"published_last" INTEGER -- stamp of latest pubdate
|
||||||
@ -52,18 +54,14 @@ CREATE TABLE "files" (
|
|||||||
-- a separate "files" table might get introduced later
|
-- a separate "files" table might get introduced later
|
||||||
CREATE TABLE "updates" (
|
CREATE TABLE "updates" (
|
||||||
"updateId" INTEGER PRIMARY KEY AUTOINCREMENT,
|
"updateId" INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
"tv" TEXT, -- target version, e.g. AAQ302
|
|
||||||
"fv" TEXT, -- from version (only for OTA)
|
|
||||||
"svn" TEXT, -- version info from <SVN> field
|
"svn" TEXT, -- version info from <SVN> field
|
||||||
"pubDate" INTEGER, -- published date
|
"pubDate" INTEGER, -- published date
|
||||||
"publisher" TEXT, -- publisher
|
"publisher" TEXT, -- publisher
|
||||||
"fwId" TEXT, -- <FW_ID> (CHANGES FOR THE SAME FILE_ID!!!) MAYBE MOVE TO update_map
|
"fwId" TEXT, -- <FW_ID> (CHANGES FOR THE SAME FILE_ID!!!) MAYBE MOVE TO update_map
|
||||||
"file_id" TEXT, -- <FILE_ID> of first file
|
"file_id" TEXT, -- <FILE_ID> of first file
|
||||||
"file_sha1" TEXT -- SHA1 checksum of first file
|
"file_sha1" TEXT REFERENCES "files" ("sha1") -- SHA1 checksum of first file
|
||||||
);
|
);
|
||||||
CREATE UNIQUE INDEX "index_updates" ON "updates" (
|
CREATE UNIQUE INDEX "index_updates" ON "updates" (
|
||||||
"tv",
|
|
||||||
"fv",
|
|
||||||
"fwId",
|
"fwId",
|
||||||
"file_id"
|
"file_id"
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user