added geography schema and changed skill schema to put all the skill display data in a single table.
parent
c3608a10bf
commit
a792245218
|
@ -1 +1 @@
|
|||
CREATE DATABASE mycroft WITH TEMPLATE mycroft_template OWNER mycroft;
|
||||
CREATE DATABASE mycroft WITH TEMPLATE mycroft_template OWNER selene;
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
-- create the schema that will be used to geographical reference data
|
||||
CREATE SCHEMA geography;
|
|
@ -0,0 +1,2 @@
|
|||
GRANT USAGE ON SCHEMA geography TO selene;
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA geography TO selene;
|
|
@ -0,0 +1,14 @@
|
|||
CREATE TABLE geography.city (
|
||||
id uuid PRIMARY KEY
|
||||
DEFAULT gen_random_uuid(),
|
||||
region_id uuid NOT NULL
|
||||
REFERENCES geography.region,
|
||||
timezone_id uuid NOT NULL
|
||||
REFERENCES geography.timezone,
|
||||
name text NOT NULL,
|
||||
latitude NUMERIC NOT NULL,
|
||||
longitude NUMERIC NOT NULL,
|
||||
insert_ts TIMESTAMP NOT NULL
|
||||
DEFAULT CURRENT_TIMESTAMP
|
||||
|
||||
)
|
|
@ -0,0 +1,9 @@
|
|||
CREATE TABLE geography.country (
|
||||
id uuid PRIMARY KEY
|
||||
DEFAULT gen_random_uuid(),
|
||||
iso_code CHAR(2) NOT NULL
|
||||
UNIQUE,
|
||||
name text NOT NULL,
|
||||
insert_ts TIMESTAMP NOT NULL
|
||||
DEFAULT CURRENT_TIMESTAMP
|
||||
)
|
|
@ -0,0 +1,10 @@
|
|||
CREATE TABLE geography.region (
|
||||
id uuid PRIMARY KEY
|
||||
DEFAULT gen_random_uuid(),
|
||||
country_id uuid NOT NULL
|
||||
REFERENCES geography.country,
|
||||
region_code VARCHAR(20) NOT NULL UNIQUE,
|
||||
name text NOT NULL,
|
||||
insert_ts TIMESTAMP NOT NULL
|
||||
DEFAULT CURRENT_TIMESTAMP
|
||||
)
|
|
@ -0,0 +1,11 @@
|
|||
CREATE TABLE geography.timezone (
|
||||
id uuid PRIMARY KEY
|
||||
DEFAULT gen_random_uuid(),
|
||||
country_id uuid NOT NULL
|
||||
REFERENCES geography.country,
|
||||
name text NOT NULL UNIQUE,
|
||||
gmt_offset NUMERIC NOT NULL,
|
||||
dst_offset NUMERIC,
|
||||
insert_ts TIMESTAMP NOT NULL
|
||||
DEFAULT CURRENT_TIMESTAMP
|
||||
)
|
|
@ -1,7 +0,0 @@
|
|||
CREATE TABLE skill.activation (
|
||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
skill_id uuid NOT NULL REFERENCES skill.skill,
|
||||
activation text NOT NULL,
|
||||
insert_ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE (skill_id, activation)
|
||||
);
|
|
@ -1,14 +0,0 @@
|
|||
CREATE TABLE skill.branch (
|
||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
skill_id uuid NOT NULL REFERENCES skill.skill,
|
||||
repository_name text NOT NULL,
|
||||
branch text NOT NULL,
|
||||
display_name text,
|
||||
short_description text,
|
||||
long_description text,
|
||||
icon_name text,
|
||||
icon_color text,
|
||||
icon_image_url text,
|
||||
insert_ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE (repository_name, branch)
|
||||
);
|
|
@ -1,7 +0,0 @@
|
|||
CREATE TABLE skill.category (
|
||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
skill_id uuid NOT NULL REFERENCES skill.skill,
|
||||
category category_enum NOT NULL,
|
||||
insert_ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE (skill_id, category)
|
||||
);
|
|
@ -1,8 +0,0 @@
|
|||
CREATE TABLE skill.credit (
|
||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
skill_id uuid NOT NULL REFERENCES skill.skill,
|
||||
github_id text NOT NULL,
|
||||
github_name text NOT NULL,
|
||||
insert_ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE (skill_id, github_id)
|
||||
);
|
|
@ -0,0 +1,10 @@
|
|||
CREATE TABLE skill.display (
|
||||
id uuid PRIMARY KEY
|
||||
DEFAULT gen_random_uuid(),
|
||||
skill_name text NOT NULL,
|
||||
core_version core_version_enum NOT NULL,
|
||||
display_data json NOT NULL,
|
||||
insert_ts TIMESTAMP NOT NULL
|
||||
DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE (skill_name, core_version)
|
||||
);
|
|
@ -1,7 +0,0 @@
|
|||
CREATE TABLE skill.platform (
|
||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
skill_id uuid NOT NULL REFERENCES skill.skill,
|
||||
platform text NOT NULL,
|
||||
insert_ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE (skill_id, platform)
|
||||
);
|
|
@ -1,12 +0,0 @@
|
|||
CREATE TABLE skill.setting_meta (
|
||||
id uuid PRIMARY KEY
|
||||
DEFAULT gen_random_uuid(),
|
||||
skill_id uuid NOT NULL
|
||||
REFERENCES skill.skill
|
||||
ON DELETE CASCADE,
|
||||
version text NOT NULL,
|
||||
settings_meta json NOT NULL,
|
||||
insert_ts TIMESTAMP NOT NULL
|
||||
DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE (skill_id, version)
|
||||
);
|
|
@ -1,7 +0,0 @@
|
|||
CREATE TABLE skill.tag (
|
||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
skill_id uuid NOT NULL REFERENCES skill.skill,
|
||||
tag text NOT NULL,
|
||||
insert_ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE (skill_id, tag)
|
||||
);
|
|
@ -0,0 +1 @@
|
|||
CREATE TYPE core_version_enum AS ENUM ('18.08', '19.02');
|
Loading…
Reference in New Issue