Skip to content

Commit

Permalink
Add check constraints for container.version_ttl_seconds and blobs.size (
Browse files Browse the repository at this point in the history
#268)

To ensure data integrity

Ref: #196

Signed-off-by: Igor Shishkin <me@teran.ru>
  • Loading branch information
teran authored Nov 26, 2024
1 parent 3816e5c commit bde668c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
BEGIN;

ALTER TABLE blobs
DROP CONSTRAINT size_range
;

ALTER TABLE containers
DROP CONSTRAINT version_ttl_seconds_range
;

COMMIT;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
BEGIN;

ALTER TABLE blobs
ADD CONSTRAINT size_range CHECK (size >= 0)
;

ALTER TABLE containers
ADD CONSTRAINT version_ttl_seconds_range CHECK (version_ttl_seconds >= -1)
;

COMMIT;

0 comments on commit bde668c

Please sign in to comment.