1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 13:12:41 +00:00

Add modification timestamp to user metadata

This commit is contained in:
J. King 2020-12-08 16:10:23 -05:00
parent d85988f09d
commit 5c83655541
4 changed files with 5 additions and 2 deletions

View file

@ -322,8 +322,8 @@ class Database {
}
$tr = $this->begin();
$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");
$insert = $this->db->prepare("INSERT INTO arsse_user_meta values(?, ?, ?)", "str", "strict 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(owner, \"key\", value) values(?, ?, ?)", "str", "strict str", "str");
foreach ($data as $k => $v) {
if ($k === "admin") {
$this->db->prepare("UPDATE arsse_users SET admin = ? where id = ?", "bool", "str")->run($v, $user);

View file

@ -22,6 +22,7 @@ alter table arsse_users modify num bigint unsigned not null;
create table arsse_user_meta(
owner varchar(255) not null,
"key" varchar(255) not null,
modified datetime(0) not null default CURRENT_TIMESTAMP,
value longtext,
foreign key(owner) references arsse_users(id) on delete cascade on update cascade,
primary key(owner,"key")

View file

@ -23,6 +23,7 @@ alter table arsse_users alter column num set not null;
create table arsse_user_meta(
owner text not null references arsse_users(id) on delete cascade on update cascade,
key text not null,
modified timestamp(0) without time zone not null default CURRENT_TIMESTAMP,
value text,
primary key(owner,key)
);

View file

@ -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
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
modified text not null default CURRENT_TIMESTAMP, -- time at which the metadata was last changed
value text, -- metadata value
primary key(owner,key)
) without rowid;