Browse Source

fix some schema issues

master
Gibheer 1 year ago
parent
commit
c18d165a5f
  1. 12
      schema/01_initial.sql

12
schema/01_initial.sql

@ -16,8 +16,8 @@ create table if not exists pools(
primary key(layer3domain_id, id)
);
create table if not exists container(
layer3domain_id integer not null references layer3domain(id),
create table if not exists containers(
layer3domain_id integer not null references layer3domains(id),
network cidr not null,
pool_id integer not null,
created_at timestamptz not null default now(),
@ -26,14 +26,14 @@ create table if not exists container(
modified_by varchar(128) not null,
attributes jsonb not null default '{}'::jsonb,
unique(layer3domain_id, network),
foreign key (layer3domain_id, pool_id) references pools(layer3domain_id, pool_id)
foreign key (layer3domain_id, pool_id) references pools(layer3domain_id, id)
);
create index on container(layer3domain_id, pool_id, network);
create index if not exists container_reference_key on containers(layer3domain_id, pool_id, network);
create table if not exists ips(
layer3domain_id integer not null,
version smallint not null,
address decimal(40,0) not null,
address inet not null,
attributes jsonb not null default '{}'::jsonb,
created_at timestamptz not null default now(),
created_by varchar(128) not null,
@ -70,7 +70,7 @@ create table if not exists zoneviews(
modified_at timestamptz not null default now(),
modified_by varchar(128) not null
);
create index on zoneviews(zone_id, id);
create index if not exists zoneviews_reference_key on zoneviews(zone_id, id);
create table if not exists records(
zoneview_id integer not null references zoneviews(id) on delete cascade,

Loading…
Cancel
Save