🎉 Add plugable storages abstraction layer (with support for fs, s3 and db).

This commit is contained in:
Andrey Antukh 2020-12-30 14:38:00 +01:00 committed by Alonso Torres
parent 9146642947
commit 760eb926bf
16 changed files with 893 additions and 17 deletions

View file

@ -0,0 +1,22 @@
CREATE TABLE storage_object (
id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
created_at timestamptz NOT NULL DEFAULT now(),
deleted_at timestamptz NULL DEFAULT NULL,
size bigint NOT NULL DEFAULT 0,
backend text NOT NULL,
metadata jsonb NULL DEFAULT NULL
);
CREATE TABLE storage_data (
id uuid PRIMARY KEY REFERENCES storage_object (id) ON DELETE CASCADE,
data bytea NOT NULL
);
CREATE INDEX storage_data__id__idx ON storage_data(id);
CREATE INDEX storage_object__id__deleted_at__idx
ON storage_object(id, deleted_at)
WHERE deleted_at IS NOT null;