Notes/sql/0003.sql

11 lines
429 B
MySQL
Raw Normal View History

2023-06-21 23:52:21 +02:00
CREATE TABLE public.file (
id serial NOT NULL,
user_id int4 NOT NULL,
filename varchar(256) NOT NULL DEFAULT '<noname>',
"size" int4 NOT NULL DEFAULT 0,
mime varchar(256) NOT NULL DEFAULT '',
uploaded timestamp NOT NULL DEFAULT NOW(),
CONSTRAINT file_pk PRIMARY KEY (id),
CONSTRAINT file_fk FOREIGN KEY (user_id) REFERENCES public."user"(id) ON DELETE RESTRICT ON UPDATE RESTRICT
);