Add missing foreign key between season_calendar and season

This commit is contained in:
jordi fita mas 2024-03-14 18:38:58 +01:00
parent cb1e3afb44
commit cc1b334639
5 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,11 @@
-- Deploy camper:season_calendar_season_id_fkey to pg
-- requires: season
-- requires: season_calendar
begin;
alter table camper.season_calendar
add constraint season_calendar_season_id_fkey foreign key (season_id) references camper.season (season_id)
;
commit;

View File

@ -0,0 +1,9 @@
-- Revert camper:season_calendar_season_id_fkey from pg
begin;
alter table camper.season_calendar
drop constraint if exists season_calendar_season_id_fkey
;
commit;

View File

@ -265,3 +265,5 @@ draft_payment [draft_payment@v4 company__tourist_tax_max_days] 2024-02-27T17:49:
grant_select_on_payment_status_to_guest [roles payment_status payment_status_i18n] 2024-02-29T16:42:13Z jordi fita mas <jordi@tandem.blog> # Grant SELECT on payment_status and payment_status_i18n to guest grant_select_on_payment_status_to_guest [roles payment_status payment_status_i18n] 2024-02-29T16:42:13Z jordi fita mas <jordi@tandem.blog> # Grant SELECT on payment_status and payment_status_i18n to guest
flush_payments [roles schema_camper payment payment_option payment_redsys_response] 2024-03-13T12:58:04Z jordi fita mas <jordi@tandem.blog> # Add function to flush payments flush_payments [roles schema_camper payment payment_option payment_redsys_response] 2024-03-13T12:58:04Z jordi fita mas <jordi@tandem.blog> # Add function to flush payments
@v5 2024-03-13T19:55:03Z jordi fita mas <jordi@tandem.blog> # Tag v5 @v5 2024-03-13T19:55:03Z jordi fita mas <jordi@tandem.blog> # Tag v5
season_calendar_season_id_fkey [season season_calendar] 2024-03-14T17:04:30Z jordi fita mas <jordi@tandem.blog> # Add foreign constraint between season_calendar and season

View File

@ -5,7 +5,7 @@ reset client_min_messages;
begin; begin;
select plan(29); select plan(31);
set search_path to camper, public; set search_path to camper, public;
@ -18,6 +18,8 @@ select table_privs_are('season_calendar', 'admin', array['SELECT', 'INSERT', 'UP
select table_privs_are('season_calendar', 'authenticator', array[]::text[]); select table_privs_are('season_calendar', 'authenticator', array[]::text[]);
select has_column('season_calendar', 'season_id'); select has_column('season_calendar', 'season_id');
select col_is_fk('season_calendar', 'season_id');
select fk_ok('season_calendar', 'season_id', 'season', 'season_id');
select col_type_is('season_calendar', 'season_id', 'integer'); select col_type_is('season_calendar', 'season_id', 'integer');
select col_not_null('season_calendar', 'season_id'); select col_not_null('season_calendar', 'season_id');
select col_hasnt_default('season_calendar', 'season_id'); select col_hasnt_default('season_calendar', 'season_id');

View File

@ -0,0 +1,16 @@
-- Verify camper:season_calendar_season_id_fkey on pg
begin;
select 1/count(*)
from information_schema.constraint_column_usage
where table_catalog = 'camper'
and table_schema = 'camper'
and table_name = 'season'
and column_name = 'season_id'
and constraint_catalog = 'camper'
and constraint_schema = 'camper'
and constraint_name = 'season_calendar_season_id_fkey'
;
rollback;