Add table for sub region type

This commit is contained in:
WQY\qiong
2023-05-13 18:00:52 +08:00
parent 99775af649
commit 6d30bf7d70
10 changed files with 30 additions and 0 deletions

View File

@@ -1,6 +1,9 @@
create type region_type as enum ('NONE', 'DMA', 'SA', 'VD', 'WDA');
create table region
(
id text primary key
, r_type region_type not null default 'NONE'
, boundary geometry not null unique
);

View File

@@ -0,0 +1,5 @@
create table region_dma
(
id text primary key references region(id)
, parent text references region_dma(id)
);

View File

@@ -0,0 +1,6 @@
create table region_sa
(
id text primary key references region(id)
, source varchar(32) not null -- references _node(id)
, time_index integer not null
);

View File

@@ -0,0 +1,5 @@
create table region_vd
(
id text primary key references region(id)
, source varchar(32) not null -- references _node(id)
);

View File

@@ -0,0 +1,5 @@
create table region_wda
(
id text primary key references region(id)
, demand float8 not null default 0.0
);

View File

@@ -11,3 +11,5 @@ drop table if exists temp_region;
drop index if exists region_gist;
drop table if exists region;
drop type if exists region_type;

View File

@@ -0,0 +1 @@
drop table if exists region_dma;

View File

@@ -0,0 +1 @@
drop table if exists region_sa;

View File

@@ -0,0 +1 @@
drop table if exists region_vd;

View File

@@ -0,0 +1 @@
drop table if exists region_wda;