diff --git a/lib/Database.php b/lib/Database.php index f961f7d..b2a7aa3 100644 --- a/lib/Database.php +++ b/lib/Database.php @@ -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); diff --git a/sql/MySQL/6.sql b/sql/MySQL/6.sql index 23ba5ed..36b2d6e 100644 --- a/sql/MySQL/6.sql +++ b/sql/MySQL/6.sql @@ -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") diff --git a/sql/PostgreSQL/6.sql b/sql/PostgreSQL/6.sql index 0b405a2..a32eb0c 100644 --- a/sql/PostgreSQL/6.sql +++ b/sql/PostgreSQL/6.sql @@ -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) ); diff --git a/sql/SQLite3/6.sql b/sql/SQLite3/6.sql index 9e86182..81e9e82 100644 --- a/sql/SQLite3/6.sql +++ b/sql/SQLite3/6.sql @@ -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;