create table template_groups
(
    template_id bigint not null references templates (id) on update cascade on delete cascade,
    group_id    bigint not null references groups (id) on update cascade on delete cascade,
    primary key (template_id, group_id)
);

create index template_groups_group_id_idx on template_groups (group_id);
