mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 13:12:41 +00:00
Use a Unicode collation for SQLite
This commit is contained in:
parent
a8e6487001
commit
0f48ce6f37
3 changed files with 8 additions and 3 deletions
|
@ -57,6 +57,10 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
|
||||||
$this->setTimeout($timeout);
|
$this->setTimeout($timeout);
|
||||||
// set other initial options
|
// set other initial options
|
||||||
$this->exec("PRAGMA foreign_keys = yes");
|
$this->exec("PRAGMA foreign_keys = yes");
|
||||||
|
// use a case-insensitive Unicode collation sequence
|
||||||
|
$this->collator = new \Collator("@kf=false");
|
||||||
|
$m = ($this->db instanceof \PDO) ? "sqliteCreateCollation" : "createCollation";
|
||||||
|
$this->db->$m("nocase", [$this->collator, "compare"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function requirementsMet(): bool {
|
public static function requirementsMet(): bool {
|
||||||
|
|
|
@ -4,9 +4,7 @@
|
||||||
|
|
||||||
-- Please consult the SQLite 3 schemata for commented version
|
-- Please consult the SQLite 3 schemata for commented version
|
||||||
|
|
||||||
-- create a case-insensitive generic collation sequence
|
-- create a case-insensitive generic Unicode collation sequence
|
||||||
-- this collation is Unicode-aware, whereas SQLite's built-in nocase
|
|
||||||
-- collation is ASCII-only
|
|
||||||
create collation nocase(
|
create collation nocase(
|
||||||
provider = icu,
|
provider = icu,
|
||||||
locale = '@kf=false'
|
locale = '@kf=false'
|
||||||
|
|
|
@ -19,6 +19,9 @@ create table arsse_marks(
|
||||||
insert into arsse_marks select article,subscription,read,starred,modified,note,0 from arsse_marks_old;
|
insert into arsse_marks select article,subscription,read,starred,modified,note,0 from arsse_marks_old;
|
||||||
drop table arsse_marks_old;
|
drop table arsse_marks_old;
|
||||||
|
|
||||||
|
-- reindex anything which uses the nocase collation sequence; it has been replaced with a Unicode collation
|
||||||
|
reindex nocase;
|
||||||
|
|
||||||
-- set version marker
|
-- set version marker
|
||||||
pragma user_version = 4;
|
pragma user_version = 4;
|
||||||
update arsse_meta set value = '4' where key = 'schema_version';
|
update arsse_meta set value = '4' where key = 'schema_version';
|
||||||
|
|
Loading…
Reference in a new issue