-- 33절. prices 와 order_items 의 기간 단위에 day 와 hour. -- 001_init.sql 부터 005_login_lock.sql 까지는 고치지 않는다. -- 트리거와 함수는 만들지 않는다. alter table prices drop constraint prices_period_unit_check; alter table prices add constraint prices_period_unit_check check (period_unit in ('year', 'month', 'day', 'hour', 'once')); alter table prices add constraint prices_day_hour_count_check check (period_unit not in ('day', 'hour') or period_count >= 1); alter table prices add constraint prices_day_hour_action_check check (period_unit not in ('day', 'hour') or action not in ('owner_change', 'usage')); alter table order_items drop constraint order_items_period_unit_check; alter table order_items add constraint order_items_period_unit_check check (period_unit in ('year', 'month', 'day', 'hour', 'once')); alter table order_items add constraint order_items_day_hour_count_check check (period_unit <> 'hour' or period_count >= 1); alter table order_items add constraint order_items_day_hour_action_check check (period_unit not in ('day', 'hour') or action not in ('owner_change', 'usage'));