DBI File Backend #13

Closed
opened 2017-04-13 06:34:54 +00:00 by jamie · 1 comment
jamie commented 2017-04-13 06:34:54 +00:00 (Migrated from git.hazaar.io)

This backend will work similar to the MongoDB backend and allow files to be stored in a PDO database using the Hazaar\DBI library.

Main file table:

CREATE TABLE public.file
(
    id serial,
    kind text,
    parents integer[],
    filename text,
    created_on timestamp without time zone,
    modified_on timestamp without time zone,
    length integer,
    mime_type text,
    md5 text,
    owner text,
    group text,
    mode text,
    metadata json,
    PRIMARY KEY (id)
)
WITH (
    OIDS = FALSE
)
TABLESPACE pg_default;

File data chunk table:

CREATE TABLE public.file_chunk
(
    id serial,
    file_id integer NOT NULL,
    n integer NOT NULL,
    data bytea,
    PRIMARY KEY (id),
    FOREIGN KEY (file_id)
        REFERENCES public.file (id) MATCH SIMPLE
        ON UPDATE NO ACTION
        ON DELETE NO ACTION
)
WITH (
    OIDS = FALSE
)
TABLESPACE pg_default;

While I have built this to support chunks in the database, the backend itself currently only writes a single chunk. However, reads handle multiple data chunks.

This backend will work similar to the MongoDB backend and allow files to be stored in a PDO database using the Hazaar\DBI library. Main file table: ``` CREATE TABLE public.file ( id serial, kind text, parents integer[], filename text, created_on timestamp without time zone, modified_on timestamp without time zone, length integer, mime_type text, md5 text, owner text, group text, mode text, metadata json, PRIMARY KEY (id) ) WITH ( OIDS = FALSE ) TABLESPACE pg_default; ``` File data chunk table: ``` CREATE TABLE public.file_chunk ( id serial, file_id integer NOT NULL, n integer NOT NULL, data bytea, PRIMARY KEY (id), FOREIGN KEY (file_id) REFERENCES public.file (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION ) WITH ( OIDS = FALSE ) TABLESPACE pg_default; ``` While I have built this to support chunks in the database, the backend itself currently only writes a single chunk. However, reads handle multiple data chunks.
jamie commented 2017-04-16 06:08:46 +00:00 (Migrated from git.hazaar.io)

closed

closed
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: hazaar/hazaar-dbi#13
No description provided.