diff --git a/controller/store/sql/postgresql/002_ingress_selection.sql b/controller/store/sql/postgresql/002_ingress_selection.sql index e69b9a30..7d3a9e90 100644 --- a/controller/store/sql/postgresql/002_ingress_selection.sql +++ b/controller/store/sql/postgresql/002_ingress_selection.sql @@ -1,9 +1,16 @@ -- +migrate Up -create table ingress ( +create type availability_type as enum ('public', 'private'); + +create table frontends ( id serial primary key, - account_id integer references accounts(id), + environment_id integer references environments(id), z_id varchar(32) not null unique, + type availability_type not null, created_at timestamptz not null default(current_timestamp), updated_at timestamptz not null default(current_timestamp) -); \ No newline at end of file +); + +-- environments.account_id should allow NULL; environments with NULL account_id are "ephemeral" +alter table environments drop constraint fk_accounts_identities; +alter table environments add constraint fk_accounts_id foreign key (account_id) references accounts(id); \ No newline at end of file