camper/deploy/acsi_option__option_group.sql
jordi fita mas 746aa013d3 Group ACSI options and allow for usage in different groups
It turns out that, **this time**, at least, the way to compute the
discount is not by “the more expensive”, but “the more expensive _in a
given group_”.

However, there are a couple of options, such as motorhome, that can be
in different groups but only must be used once.
2024-04-03 12:56:52 +02:00

22 lines
423 B
PL/PgSQL

-- Deploy camper:acsi_option__option_group to pg
-- requires: acsi_option
begin;
set search_path to camper, public;
alter table acsi_option
add column option_group integer not null default 0
;
alter table acsi_option
drop constraint if exists acsi_option_pkey
;
alter table acsi_option
add primary key (campsite_type_id, campsite_type_option_id, option_group)
, alter column option_group drop default
;
commit;