datatrash/init-db.sql

18 lines
738 B
MySQL
Raw Normal View History

2020-07-09 20:01:25 +00:00
CREATE TABLE IF NOT EXISTS files (
id serial,
2020-07-24 17:56:17 +00:00
file_id varchar(255) not null unique,
2020-07-09 20:01:25 +00:00
file_name varchar(255) not null,
valid_till timestamp not null,
kind varchar(255) not null,
primary key (id)
);
ALTER TABLE files ADD COLUMN IF NOT EXISTS delete_on_download boolean;
2021-09-24 20:51:13 +00:00
ALTER TABLE files ALTER COLUMN delete_on_download set not null;
2022-02-27 00:50:29 +00:00
ALTER TABLE files ALTER COLUMN valid_till TYPE timestamptz;
ALTER TABLE files ADD COLUMN IF NOT EXISTS content_type varchar(255);
2022-09-30 13:06:24 +00:00
UPDATE files set content_type = 'text/plain' where kind = 'text';
UPDATE files set content_type = 'application/octet-stream' where kind = 'binary';
ALTER TABLE files ALTER COLUMN content_type set not null;
ALTER TABLE files DROP COLUMN IF EXISTS kind;