# Database structure for kabano.org open-source project
# This file is designed to be imported in quickdatabasediagrams.com

locales
-
name PK varchar(32)
display_name UNIQUE varchar(255)
flag_name UNIQUE NULL varchar(32)

users
-
id PK int4
name UNIQUE varchar(255) # The unique constraint is done with version
version UNIQUE int4 # The unique constraint is done with name
email UNIQUE varchar(255)
password varchar(255)
website NULL varchar(255)
is_avatar_present boolean
is_archive INDEX boolean
rank user_rank_enum # blocked; registered; premium; moderator; admin
locale varchar(32) FK >- locales.name
timezone varchar(8)
visit_date timestamp
register_date INDEX timestamp

pois
-
id PK int4
permalink UNIQUE varchar(255) # The unique constraint is done with version
version UNIQUE int4 # The unique constraint is done with permalink
creation_date timestamp
update_date timestamp
author int4 FK >- users.id
is_public INDEX boolean
is_archive INDEX boolean
type INDEX poi_type_enum # basic_hut; wilderness_hut; alpine_hut; halt; bivouac; campsite
is_destroyed INDEX boolean
name varchar(255)
alt_names NULL varchar(255)
source NULL varchar(3) FK >- poi_sources.id
source_id NULL varchar(255)
position geometry # Contains elevation data
parameters NULL jsonb

poi_localised
-
id PK int4
poi UNIQUE int4 FK >- pois.id # The unique constraint is done with locale, key
locale UNIQUE varchar(32) FK >- locales.name # The unique constraint is done with poi, key
key UNIQUE poi_key_enum # description; access # The unique constraint is done with poi, locale
value text

poi_sources
-
id PK varchar(3)
display_name UNIQUE varchar(255)
icon_name NULL varchar(255)
website NULL varchar(255)
license_name NULL varchar(255)
license_url NULL varchar(255)

poi_contributors
-
id PK int4
poi UNIQUE int4 FK >- pois.id # The unique constraint is done with contributor
contributor UNIQUE int4 FK >- users.id # The unique constraint is done with poi

poi_comments
-
id PK int4
permalink UNIQUE varchar(255) # The unique constraint is done with version
version UNIQUE int4 # The unique constraint is done with permalink
creation_date timestamp
update_date timestamp
author int4 FK >- users.id
is_public INDEX boolean
is_archive INDEX boolean
poi int4 FK >- pois.id
comment text
locale varchar(32) FK >- locales.name

contents
-
id PK int4
permalink UNIQUE varchar(255) # The unique constraint is done with version and locale
version UNIQUE int4 # The unique constraint is done with permalink and locale
locale UNIQUE varchar(32) FK >- locales.name # The unique constraint is done with permalink and version
creation_date timestamp
update_date timestamp
author int4 FK >- users.id
is_public INDEX boolean
is_archive INDEX boolean
is_commentable boolean
type INDEX content_type_enum # wiki, blog, forum
name varchar(255)
content text

content_contributors
-
id PK int4
content UNIQUE int4 FK >- contents.id # The unique constraint is done with contributor
contributor UNIQUE int4 FK >- users.id # The unique constraint is done with content

content_comments
-
id PK int4
permalink UNIQUE varchar(255) # The unique constraint is done with version
version UNIQUE int4 # The unique constraint is done with permalink
creation_date timestamp
update_date timestamp
author int4 FK >- users.id
is_public INDEX boolean
is_archive INDEX boolean
content int4 FK >- contents.id
comment text
locale varchar(32) FK >- locales.name