Refactor command message deletion

This commit is contained in:
Ske
2020-10-23 12:18:28 +02:00
parent 134829b263
commit 81cd5496d5
7 changed files with 117 additions and 46 deletions

View File

@@ -1,17 +1,10 @@
-- SCHEMA VERSION 11: (insert date) --
-- SCHEMA VERSION 11: 2020-10-23 --
-- Create command message table --
create table command_message
create table command_messages
(
message_id bigint primary key,
author_id bigint not null,
timestamp timestamp not null default now()
message_id bigint primary key not null,
author_id bigint not null
);
create function cleanup_command_message() returns void as $$
begin
delete from command_message where timestamp < now() - interval '2 hours';
end;
$$ language plpgsql;
update info set schema_version = 11;