Skip to content

Commit

Permalink
(PC-33672)[API] script: validate check_ean_constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeoffray-pass committed Jan 17, 2025
1 parent d2c9a2f commit cba9345
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions api/src/pcapi/scripts/validate_check_ean_constraint/main.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
SET SESSION statement_timeout = '300s';

ALTER TABLE offer VALIDATE CONSTRAINT "check_ean_validity";

SET SESSION statement_timeout = 60000; -- restore value set in helm/pcapi/production/values-configmaps.yaml:

-- print invalid constraints
select
-- `conrelid` is 0 if not a table constraint
case
when pg_constraint.conrelid != 0 then (pg_class.relname || '.')
else ''
end || pg_constraint.conname
from
pg_constraint
left outer join pg_class on pg_class.oid = pg_constraint.conrelid
where
not convalidated;

0 comments on commit cba9345

Please sign in to comment.