Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/sql/30-swh-schema.sql
--- | --- | ||||
--- Software Heritage Indexers Data Model | --- Software Heritage Indexers Data Model | ||||
--- | --- | ||||
-- drop schema if exists swh cascade; | -- drop schema if exists swh cascade; | ||||
-- create schema swh; | -- create schema swh; | ||||
-- set search_path to swh; | -- set search_path to swh; | ||||
create table dbversion | create table dbversion | ||||
( | ( | ||||
version int primary key, | version int primary key, | ||||
release timestamptz, | release timestamptz, | ||||
description text | description text | ||||
); | ); | ||||
insert into dbversion(version, release, description) | insert into dbversion(version, release, description) | ||||
values(116, now(), 'Work In Progress'); | values(118, now(), 'Work In Progress'); | ||||
-- Computing metadata on sha1's contents | -- Computing metadata on sha1's contents | ||||
-- a SHA1 checksum (not necessarily originating from Git) | -- a SHA1 checksum (not necessarily originating from Git) | ||||
create domain sha1 as bytea check (length(value) = 20); | create domain sha1 as bytea check (length(value) = 20); | ||||
-- a Git object ID, i.e., a SHA1 checksum | -- a Git object ID, i.e., a SHA1 checksum | ||||
create domain sha1_git as bytea check (length(value) = 20); | create domain sha1_git as bytea check (length(value) = 20); | ||||
create table indexer_configuration ( | create table indexer_configuration ( | ||||
id serial not null, | id serial not null, | ||||
tool_name text not null, | tool_name text not null, | ||||
tool_version text not null, | tool_version text not null, | ||||
tool_configuration jsonb | tool_configuration jsonb | ||||
); | ); | ||||
comment on table indexer_configuration is 'Indexer''s configuration version'; | comment on table indexer_configuration is 'Indexer''s configuration version'; | ||||
comment on column indexer_configuration.id is 'Tool identifier'; | comment on column indexer_configuration.id is 'Tool identifier'; | ||||
comment on column indexer_configuration.tool_version is 'Tool name'; | comment on column indexer_configuration.tool_version is 'Tool name'; | ||||
comment on column indexer_configuration.tool_version is 'Tool version'; | comment on column indexer_configuration.tool_version is 'Tool version'; | ||||
comment on column indexer_configuration.tool_configuration is 'Tool configuration: command line, flags, etc...'; | comment on column indexer_configuration.tool_configuration is 'Tool configuration: command line, flags, etc...'; | ||||
-- Properties (mimetype, encoding, etc...) | -- Properties (mimetype, encoding, etc...) | ||||
create table content_mimetype ( | create table content_mimetype ( | ||||
id sha1 not null, | id sha1 not null, | ||||
mimetype bytea not null, | mimetype text not null, | ||||
encoding bytea not null, | encoding text not null, | ||||
indexer_configuration_id bigint not null | indexer_configuration_id bigint not null | ||||
); | ); | ||||
comment on table content_mimetype is 'Metadata associated to a raw content'; | comment on table content_mimetype is 'Metadata associated to a raw content'; | ||||
comment on column content_mimetype.mimetype is 'Raw content Mimetype'; | comment on column content_mimetype.mimetype is 'Raw content Mimetype'; | ||||
comment on column content_mimetype.encoding is 'Raw content encoding'; | comment on column content_mimetype.encoding is 'Raw content encoding'; | ||||
comment on column content_mimetype.indexer_configuration_id is 'Tool used to compute the information'; | comment on column content_mimetype.indexer_configuration_id is 'Tool used to compute the information'; | ||||
▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines |