Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
DDL for apps hierarchy
-- Enable Ltree
create extension if not exists ltree;
create table apps_taxonomy (
id integer,
name varchar(50),
path ltree
);
create index tree_path_idx on apps_taxonomy using gist (path);
insert into apps_taxonomy(id, name, path) values (1, 'Apps', '1');
insert into apps_taxonomy(id, name, path) values (2, 'Messenger', '1.2');
insert into apps_taxonomy(id, name, path) values (3, 'Video streaming', '1.3');
insert into apps_taxonomy(id, name, path) values (4, 'Music streaming', '1.4');
insert into apps_taxonomy(id, name, path) values (5, 'Facebook', '1.2.5');
insert into apps_taxonomy(id, name, path) values (6, 'Instagram', '1.2.6');
insert into apps_taxonomy(id, name, path)values (7, 'Whatsapp', '1.2.7');
insert into apps_taxonomy(id, name, path) values (8, 'Hike', '1.2.8');
insert into apps_taxonomy(id, name, path) values (9,'Telegram', '1.2.9');
insert into apps_taxonomy(id, name, path) values (10,'Youtube', '1.3.10');
insert into apps_taxonomy(id, name, path) values (11,'DailyMotion', '1.3.11');
insert into apps_taxonomy(id, name, path) values (12,'Amazon Prime Video', '1.3.12');
insert into apps_taxonomy(id, name, path) values (13,'Youtube Music', '1.4.13');
insert into apps_taxonomy(id, name, path) values (14,'Amazon Music', '1.4.14');
select * from apps_taxonomy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment