62 lines
2.1 KiB
SQL
62 lines
2.1 KiB
SQL
DROP TABLE IF EXISTS community_projects;
|
|
DROP TABLE IF EXISTS community_datasources;
|
|
DROP TABLE IF EXISTS community_support_orgs;
|
|
DROP TABLE IF EXISTS community_orgs;
|
|
DROP TABLE IF EXISTS communities;
|
|
|
|
CREATE TABLE communities (
|
|
id text PRIMARY KEY,
|
|
label text NOT NULL,
|
|
description text NOT NULL DEFAULT '',
|
|
status text NOT NULL DEFAULT 'hidden', -- all, manager, hidden, members
|
|
membership text NOT NULL DEFAULT 'by-invitation', -- open, by-invitation
|
|
type text NOT NULL, -- community, ri
|
|
claim text, -- managers-only, members-only, all
|
|
subjects text[],
|
|
fos text[],
|
|
sdg text[],
|
|
adv_constraints jsonb,
|
|
remove_constraints jsonb,
|
|
main_zenodo_community text,
|
|
other_zenodo_communities text[],
|
|
creation_date timestamp NOT NULL DEFAULT now(),
|
|
logo_url text
|
|
);
|
|
|
|
CREATE TABLE community_projects (
|
|
community text NOT NULL REFERENCES communities(id),
|
|
project_id text NOT NULL,
|
|
project_code text NOT NULL,
|
|
project_name text NOT NULL,
|
|
project_acronym text,
|
|
project_funder text NOT NULL,
|
|
PRIMARY KEY (community, project_id)
|
|
);
|
|
|
|
CREATE TABLE community_datasources (
|
|
community text NOT NULL REFERENCES communities(id),
|
|
ds_id text NOT NULL,
|
|
ds_name text NOT NULL,
|
|
constraints json,
|
|
PRIMARY KEY (community, ds_id)
|
|
);
|
|
|
|
CREATE TABLE community_support_orgs (
|
|
community text NOT NULL REFERENCES communities(id),
|
|
org_name text NOT NULL,
|
|
org_url text NOT NULL,
|
|
org_logourl text NOT NULL,
|
|
PRIMARY KEY (community, org_name)
|
|
);
|
|
|
|
CREATE TABLE community_orgs (
|
|
community text NOT NULL REFERENCES communities(id),
|
|
org_id text NOT NULL,
|
|
PRIMARY KEY (community, org_id)
|
|
);
|
|
|
|
CREATE INDEX community_projects_community ON community_projects(community);
|
|
CREATE INDEX community_datasources_community ON community_datasources(community);
|
|
CREATE INDEX community_support_orgs_community ON community_support_orgs(community);
|
|
CREATE INDEX community_orgs_community ON community_orgs(community);
|