mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 21:22:40 +00:00
Add modification timestamp to user metadata
This commit is contained in:
parent
d85988f09d
commit
5c83655541
4 changed files with 5 additions and 2 deletions
|
@ -322,8 +322,8 @@ class Database {
|
||||||
}
|
}
|
||||||
$tr = $this->begin();
|
$tr = $this->begin();
|
||||||
$find = $this->db->prepare("SELECT count(*) from arsse_user_meta where owner = ? and \"key\" = ?", "str", "strict str");
|
$find = $this->db->prepare("SELECT count(*) from arsse_user_meta where owner = ? and \"key\" = ?", "str", "strict str");
|
||||||
$update = $this->db->prepare("UPDATE arsse_user_meta set value = ? where owner = ? and \"key\" = ?", "str", "str", "str");
|
$update = $this->db->prepare("UPDATE arsse_user_meta set value = ?, modified = CURRENT_TIMESTAMP where owner = ? and \"key\" = ?", "str", "str", "str");
|
||||||
$insert = $this->db->prepare("INSERT INTO arsse_user_meta values(?, ?, ?)", "str", "strict str", "str");
|
$insert = $this->db->prepare("INSERT INTO arsse_user_meta(owner, \"key\", value) values(?, ?, ?)", "str", "strict str", "str");
|
||||||
foreach ($data as $k => $v) {
|
foreach ($data as $k => $v) {
|
||||||
if ($k === "admin") {
|
if ($k === "admin") {
|
||||||
$this->db->prepare("UPDATE arsse_users SET admin = ? where id = ?", "bool", "str")->run($v, $user);
|
$this->db->prepare("UPDATE arsse_users SET admin = ? where id = ?", "bool", "str")->run($v, $user);
|
||||||
|
|
|
@ -22,6 +22,7 @@ alter table arsse_users modify num bigint unsigned not null;
|
||||||
create table arsse_user_meta(
|
create table arsse_user_meta(
|
||||||
owner varchar(255) not null,
|
owner varchar(255) not null,
|
||||||
"key" varchar(255) not null,
|
"key" varchar(255) not null,
|
||||||
|
modified datetime(0) not null default CURRENT_TIMESTAMP,
|
||||||
value longtext,
|
value longtext,
|
||||||
foreign key(owner) references arsse_users(id) on delete cascade on update cascade,
|
foreign key(owner) references arsse_users(id) on delete cascade on update cascade,
|
||||||
primary key(owner,"key")
|
primary key(owner,"key")
|
||||||
|
|
|
@ -23,6 +23,7 @@ alter table arsse_users alter column num set not null;
|
||||||
create table arsse_user_meta(
|
create table arsse_user_meta(
|
||||||
owner text not null references arsse_users(id) on delete cascade on update cascade,
|
owner text not null references arsse_users(id) on delete cascade on update cascade,
|
||||||
key text not null,
|
key text not null,
|
||||||
|
modified timestamp(0) without time zone not null default CURRENT_TIMESTAMP,
|
||||||
value text,
|
value text,
|
||||||
primary key(owner,key)
|
primary key(owner,key)
|
||||||
);
|
);
|
||||||
|
|
|
@ -34,6 +34,7 @@ create table arsse_user_meta(
|
||||||
-- It is up to individual applications (i.e. the client protocols) to cooperate with names and types
|
-- It is up to individual applications (i.e. the client protocols) to cooperate with names and types
|
||||||
owner text not null references arsse_users(id) on delete cascade on update cascade, -- the user to whom the metadata belongs
|
owner text not null references arsse_users(id) on delete cascade on update cascade, -- the user to whom the metadata belongs
|
||||||
key text not null, -- metadata key
|
key text not null, -- metadata key
|
||||||
|
modified text not null default CURRENT_TIMESTAMP, -- time at which the metadata was last changed
|
||||||
value text, -- metadata value
|
value text, -- metadata value
|
||||||
primary key(owner,key)
|
primary key(owner,key)
|
||||||
) without rowid;
|
) without rowid;
|
||||||
|
|
Loading…
Reference in a new issue