-- Arborescence de la racine S3 : un nœud par fichier ou dossier. Les contenus -- sont dans le bucket sous object_key, clé fixée au dépôt : renommer ou -- déplacer ne modifie que ces lignes. La corbeille range les nœuds sous -- « .trash// ». CREATE TABLE s3_nodes ( path text PRIMARY KEY, dir text NOT NULL, name text NOT NULL, is_dir boolean NOT NULL, size bigint NOT NULL DEFAULT 0, mtime timestamptz NOT NULL, object_key text, created_by text NOT NULL DEFAULT '' ); CREATE INDEX s3_nodes_dir ON s3_nodes (dir); CREATE INDEX s3_nodes_prefix ON s3_nodes (path text_pattern_ops); CREATE TABLE s3_trash ( id text PRIMARY KEY, origin text NOT NULL, name text NOT NULL, is_dir boolean NOT NULL, size bigint NOT NULL DEFAULT 0, deleted timestamptz NOT NULL, deleted_by text NOT NULL DEFAULT '', meta jsonb ); -- Configuration de la racine S3 saisie dans l'interface d'administration -- (les variables d'environnement l'emportent champ par champ). La clé secrète -- y est chiffrée avec une clé dérivée de SHARE_SECRET. CREATE TABLE s3_config ( id integer PRIMARY KEY CHECK (id = 1), data jsonb NOT NULL, updated timestamptz NOT NULL DEFAULT clock_timestamp() );