-
Notifications
You must be signed in to change notification settings - Fork 1
Database Schema Overview


These tables hold the data for primary records of interest.
This table stores resources related to national reporting of UN Sustainable Development Goals.
- PRIMARY KEY (uuid)
- uuid : UUID DEFAULT uuid_generate_v1mc()
- content_type_id : INTEGER : REFERENCES content_type (id)
- country_id : CHARACTER(3) : REFERENCES country (iso_alpha3)
- title : TEXT NOT NULL
- organization : TEXT
- url : TEXT NOT NULL
- date_published : TIMESTAMPTZ
- image_url : TEXT
- description : TEXT
- tags : TEXT[]
- notes : TEXT
- publish : BOOLEAN DEFAULT FALSE
- tsv : TSVECTOR
- created_at : TIMESTAMPTZ NOT NULL DEFAULT now()
- updated_at : TIMESTAMPTZ NOT NULL DEFAULT now()
- Currently, only the month and year are used from the
date_publishedfield. Although it's best to maintain accuracy if possible, the specific day and time can be set to any values. - The
tagsfield should automatically be kept updated by a trigger function. Please edit any associated tags through theresource_tagsassociative table rather than this field.
This table stores records of resource submissions from the website.
- PRIMARY KEY (uuid)
- uuid : UUID DEFAULT uuid_generate_v1mc()
- resource_id : UUID : REFERENCES resource (uuid)
- status_id : INTEGER : REFERENCES submission_status (id)
- submitter_country_id : CHARACTER(3) : REFERENCES country (iso_alpha3)
- submitter_name : TEXT
- submitter_organization : TEXT
- submitter_title : TEXT
- submitter_email : TEXT
- submitter_city : TEXT
- tags : TEXT[]
- notes : TEXT
- created_at : TIMESTAMPTZ NOT NULL DEFAULT now()
- updated_at : TIMESTAMPTZ NOT NULL DEFAULT now()
This table stores relevant news items related to national reporting of UN Sustainable Development Goals.
- PRIMARY KEY (uuid)
- uuid : UUID : DEFAULT uuid_generate_v1mc()
- title : TEXT NOT NULL
- organization : TEXT
- url : TEXT
- description : TEXT
- tags : TEXT[]
- published_at : TIMESTAMPTZ NOT NULL DEFAULT now()
- publish : BOOLEAN NOT NULL DEFAULT FALSE
- created_at : TIMESTAMPTZ NOT NULL DEFAULT now()
- updated_at : TIMESTAMPTZ NOT NULL DEFAULT now()
This table stores relevant events occurring related to national reporting of UN Sustainable Development Goals.
- PRIMARY KEY (uuid)
- uuid : UUID DEFAULT uuid_generate_v1mc()
- title : TEXT NOT NULL
- url : TEXT
- description : TEXT
- start_time : TIMESTAMPTZ NOT NULL
- end_time : TIMESTAMPTZ
- locations : TEXT[]
- tags : TEXT[]
- publish : BOOLEAN NOT NULL DEFAULT FALSE
- created_at : TIMESTAMPTZ NOT NULL DEFAULT now()
- updated_at : TIMESTAMPTZ NOT NULL DEFAULT now()
These tables hold supporting metadata for the main records we're interested in.
This table stores the different resource types that resources can be associated with.
- PRIMARY KEY (id)
- id : SERIAL
- name : TEXT NOT NULL
This table stores the different countries that resources can be associated with. This is currently the list of UN member countries.
- PRIMARY KEY (iso_alpha3)
- iso_alpha3 : CHARACTER(3)
- region_id : CHARACTER(3) : REFERENCES region (m49)
- income_group : TEXT
- name : TEXT NOT NULL
This table stores the available languages that resources can be associated with.
- PRIMARY KEY (ietf_tag)
- ietf_tag : TEXT
- name : TEXT NOT NULL
- label : TEXT NOT NULL
This table stores the locations that an event can be associated with.
- PRIMARY KEY (uuid)
- uuid : UUID DEFAULT uuid_generate_v1mc(),
- name : TEXT NOT NULL UNIQUE
This table stores the possible statuses that a submission can take (i.e. Unreviewed, Under review, Accepted).
- PRIMARY KEY (id)
- id : SERIAL
- status : TEXT NOT NULL
This table stores the different tags that resources can be associated with.
- PRIMARY KEY (uuid)
- uuid : UUID DEFAULT uuid_generate_v1mc(),
- name : TEXT NOT NULL UNIQUE
This table stores different topic categories that resources can belong to.
- PRIMARY KEY (id)
- id : SERIAL
- topic : TEXT UNIQUE NOT NULL
- path : LTREE UNIQUE NOT NULL
- label : TEXT NOT NULL
- ordering : LTREE UNIQUE NOT NULL
This table stores the different regions that countries can belong to, following the United Nations geoscheme.
- PRIMARY KEY (m49)
- m49 : CHARACTER(3)
- path : LTREE UNIQUE NOT NULL
- name : TEXT NOT NULL
These tables are used to manage the many-to-many relationships between other tables.
- PRIMARY KEY (event_id, location_id)
- event_id : UUID : REFERENCES event (uuid)
- location_id : UUID : REFERENCES location (uuid)
- PRIMARY KEY (resource_id, content_type_id)
- resource_id : UUID : REFERENCES resource (uuid)
- content_type_id : INTEGER : REFERENCES content_type (id)
- PRIMARY KEY (resource_id, country_id)
- resource_id : UUID : REFERENCES resource (uuid)
- country_id : CHARACTER(3) : REFERENCES country (iso_alpha3)
- PRIMARY KEY (resource_id, language_id)
- resource_id : UUID : REFERENCES resource (uuid)
- language_id : TEXT : REFERENCES language (ietf_tag)
- PRIMARY KEY (resource_id, tag_id)
- resource_id : UUID : REFERENCES resource (uuid)
- tag_id : UUID : REFERENCES tag (uuid)
- PRIMARY KEY (topic_id, resource_id)
- resource_id : UUID : REFERENCES resource (uuid)
- topic_id : INTEGER : REFERENCES topic (id)