create schema if not exists gis;

create table if not exists gis.cartocss(
    cartocss_id  text      default next_id() not null primary key,
    cartocss_key text                              not null constraint cartocss_key_unique unique,
    name         text                              not null,
    description  text,
    config       jsonb,
    style        text,
    created_at   timestamp default now(),
    created_by   text,
    updated_by   text,
    updated_at   timestamp,
    group_id     text constraint services_group_id_fkey references group_list,
    is_public    boolean   default false           not null,
    enabled      boolean   default true            not null,
    is_static boolean not null default false,
    geom public.geometry
);

alter table gis.cartocss add column if not exists geom public.geometry;
alter table gis.cartocss add column if not exists source_path text;
alter table gis.cartocss add column if not exists card_auto boolean not null default false;
alter table gis.cartocss add column if not exists card_html text;
alter table gis.cartocss add column if not exists card_table text;
alter table gis.cartocss add column if not exists card_columns text;
alter table gis.cartocss add column if not exists is_static boolean not null default false;
