-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(PC-33672)[API] script: validate check_ean_constraint
- Loading branch information
1 parent
d2c9a2f
commit cba9345
Showing
1 changed file
with
18 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
api/src/pcapi/scripts/validate_check_ean_constraint/main.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |