create table templates
(
    id         bigint generated by default as identity primary key,
    name       varchar(255) not null unique,
    type       smallint     not null check (type > 0),
    params     jsonb        not null default '{}'::jsonb,
    created_at timestamptz  not null default now(),
    updated_at timestamptz  not null default now()
);

create index templates_type_idx on templates (type);
