Constraints

21 Foreign Key Constraints

Constraint Name Child Column Parent Column Delete Rule
comic_creator_comic_id_fkey
comic_creator.comic_id
comics.comic_id
Cascade on delete
comic_creator_creator_id_fkey
comic_creator.creator_id
creators.creator_id
Restrict delete
comic_tag_comic_id_fkey
comic_tag.comic_id
comics.comic_id
Cascade on delete
comic_tag_tag_id_fkey
comic_tag.tag_id
tags.tag_id
Cascade on delete
signatures_creator_id_fkey
signatures.signature
creators.creator_id
Restrict delete
signatures_comic_id_fkey
signatures.comic_id
comics.comic_id
Cascade on delete
variants_comic_id_fkey
variants.comic_id
comics.comic_id
Cascade on delete
comics_series_id_fkey
comics.series_id
series.series_id
Restrict delete
comic_tx_comic_id_fkey
comic_tx.comic_id
comics.comic_id
Cascade on delete
comic_tx_tx_id_fkey
comic_tx.tx_id
transactions.tx_id
Restrict delete
transactions_shop_id_fkey
transactions.shop_id
shops.shop_id
Restrict delete
grading_comic_id_fkey
grading.comic_id
comics.comic_id
Restrict delete
comic_bag_board_bag_id_fkey
comic_bag_board.bag_id
bags.bag_id
Restrict delete
comic_bag_board_comic_id_fkey
comic_bag_board.comic_id
comics.comic_id
Cascade on delete
comic_bag_board_board_id_fkey
comic_bag_board.board_id
boards.board_id
Restrict delete
comic_box_box_id_fkey
comic_box.box_id
boxes.box_id
Null on delete
comic_box_comic_id_fkey
comic_box.comic_id
comics.comic_id
Cascade on delete
comic_event_event_id_fkey
comic_event.event_id
events.event_id
Restrict delete
comic_event_comic_id_fkey
comic_event.comic_id
comics.comic_id
Cascade on delete
series_genre_series_id_fkey
series_genre.series_id
series.series_id
Cascade on delete
series_genre_genre_id_fkey
series_genre.genre_id
genres.genre_id
Restrict delete

Check Constraints

Table Constraint Name Constraint
creators creators_creator_id_check ((creator_id ~ '^CREATOR-[0-9]{3}$'::text))
comic_creator comic_creator_role_check (((role)::text = ANY ((ARRAY['ARTIST'::character varying, 'COLORIST'::character varying, 'COVER'::character varying, 'INKER'::character varying, 'LETTERER'::character varying, 'PENCILER'::character varying, 'WRITER'::character varying])::text[])))
events events_event_id_check ((event_id ~ '^EVENT-[0-9]{2}$'::text))
events events_start_date_end_date_check ((start_date < end_date))
series series_series_id_check ((series_id ~ '^S-[0-9]{3}$'::text))
series series_start_year_end_year_check (((start_year > 0) AND (end_year >= start_year)))
series series_type_check (((type)::text = ANY ((ARRAY['COLLECTION'::character varying, 'LIMITED'::character varying, 'ONE-SHOT'::character varying, 'REGULAR'::character varying])::text[])))
series series_volume_check ((volume > 0))
variants variants_order_type_check (((order_type)::text = ANY ((ARRAY['CLOSED'::character varying, 'EVENT'::character varying, 'INCENTIVE'::character varying, 'OPEN'::character varying, 'RETAILER'::character varying])::text[])))
variants variants_type_check (((type)::text = ANY ((ARRAY['BLANK'::character varying, 'COVER'::character varying, 'CONNECTING'::character varying, 'FACSIMILE'::character varying, 'FOIL'::character varying, 'METAL'::character varying, 'SECRET'::character varying, 'VIRGIN'::character varying])::text[])))
genres genres_genre_id_check ((genre_id ~ '^G-[0-9]{2}$'::text))
genres genres_genre_upper_check (((genre)::text ~ '^[A-Z]{1}'::text))
comics comics_comic_id_check ((comic_id ~ '^#[0-9]{3}$'::text))
comics comics_cover_price_check ((cover_price >= 0.00))
comics comics_distribution_check (((distribution)::text = ANY ((ARRAY['DIRECT'::character varying, 'NEWSSTAND'::character varying])::text[])))
comics comics_isbn_check (((isbn IS NULL) OR (char_length((isbn)::text) = 10) OR (char_length((isbn)::text) = 13)))
comics comics_issue_check ((issue >= (0)::numeric))
comics comics_issue_type_check ((((issue IS NOT NULL) AND (((type)::text = 'ISSUE'::text) OR ((type)::text = 'ANNUAL'::text))) OR ((issue IS NULL) AND (((type)::text <> 'ISSUE'::text) AND ((type)::text <> 'ANNUAL'::text)))))
comics comics_printing_check ((printing > 0))
comics comics_printing_format_check ((((printing IS NOT NULL) AND is_physical) OR ((printing IS NULL) AND (NOT is_physical))))
comics comics_type_check (((type)::text = ANY ((ARRAY['ISSUE'::character varying, 'ANNUAL'::character varying, 'TP'::character varying, 'HC'::character varying])::text[])))
comics comics_upc_check (((upc IS NULL) OR (char_length((upc)::text) = 15) OR (char_length((upc)::text) = 18)))
comic_tx comic_tx_purchase_price_check ((purchase_price >= 0.00))
transactions transactions_discount_check ((discount > (0)::numeric))
transactions transactions_gift_check ((((method = 'GIFT'::bpchar) AND (total IS NULL) AND (tax_rate IS NULL)) OR ((method <> 'GIFT'::bpchar) AND (tax_rate IS NOT NULL) AND (shop_id IS NOT NULL))))
transactions transactions_method_check ((method = ANY (ARRAY['CARD'::bpchar, 'CASH'::bpchar, 'GIFT'::bpchar])))
transactions transactions_tax_rate_check (((tax_rate >= (0)::numeric) AND (tax_rate <= (1)::numeric)))
transactions transactions_total_check ((total >= (0)::numeric))
transactions transactions_tx_id_check ((tx_id ~ '^TX-[0-9]{3}$'::text))
shops shops_country_check (((((type)::text <> 'ONLINE STORE'::text) AND (country IS NOT NULL)) OR (((type)::text = 'ONLINE STORE'::text) AND (country IS NULL))))
shops shops_id_check ((shop_id ~ '^SHOP-\d{3}$'::text))
shops shops_type_check (((type)::text = ANY ((ARRAY['BOOKSTORE'::character varying, 'EVENT STORE'::character varying, 'LCS'::character varying, 'LIBRARY'::character varying, 'PRIVATE SELLER'::character varying, 'PUBLISHER'::character varying, 'ONLINE STORE'::character varying])::text[])))
conventions conventions_country_check ((country ~ '[A-Z]{3}'::text))
conventions conventions_id_check ((convention_id ~ 'CON-[0-9]{2}'::text))
conventions conventions_start_end_date_check ((start_date <= end_date))
conventions conventions_state_check ((state ~ '[A-Z]{2}'::text))
conventions conventions_type_check (((type)::text = ANY ((ARRAY['COMIC-CON'::character varying, 'FAN-EXPO'::character varying])::text[])))
conventions conventions_zip_check ((zip ~ '[0-9]{5}'::text))
grading grading_cert_id_check ((cert_id ~ '^[0-9]{10}$'::text))
grading grading_company_check (((company)::text = ANY ((ARRAY['CGC'::character varying, 'CBCS'::character varying])::text[])))
grading grading_date_check ((date >= '1999-11-09'::date))
grading grading_grade_check ((grade = ANY (ARRAY[(10)::numeric, 9.9, 9.8, 9.6, 9.4, 9.2, 9.0, 8.5, 8.0, 7.5, 7.0, 6.5, 6.0, 5.5, 5.0, 4.5, 4.0, 3.5, 3.0, 2.5, 2.0, 1.5, 1.0, 0.5])))
comic_bag_board comic_bag_board_bag_date_check ((((bag_id IS NULL) AND (bag_date IS NULL)) OR ((bag_id IS NOT NULL) AND (bag_date IS NOT NULL))))
comic_bag_board comic_bag_board_board_date_check ((((board_id IS NULL) AND (board_date IS NULL)) OR ((board_id IS NOT NULL) AND (board_date IS NOT NULL))))
comic_event comic_event_not_null_rank_role_check ((((rank = 0) AND ((role)::text = 'GUIDE'::text)) OR ((rank > 0) AND ((role)::text <> 'GUIDE'::text))))
comic_event comic_event_null_rank_role_check ((((rank IS NULL) AND ((role)::text = 'COLLECTION'::text)) OR ((rank IS NOT NULL) AND ((role)::text <> 'COLLECTION'::text))))
comic_event comic_event_role_check (((role)::text = ANY ((ARRAY['COLLECTION'::character varying, 'CORE'::character varying, 'EPILOGUE'::character varying, 'GUIDE'::character varying, 'PROLOGUE'::character varying, 'TIE-IN'::character varying])::text[])))
bags bags_bag_id_check ((bag_id ~ '^BAG-\d{2}$'::text))
bags bags_dimensions_check (((dimensions)::text ~ '^((\d+) |(\d+\/\d+) |(\d+) (\d+\/\d+) )x( (\d+)| (\d+\/\d+)| (\d+) (\d+\/\d+))$'::text))
bags bags_thickness_check ((thickness > 0))
boards boards_age_check (((age)::text = ANY ((ARRAY['CURRENT'::character varying, 'MODERN'::character varying, 'CURRENT/MODERN'::character varying, 'GOLDEN'::character varying, 'SILVER'::character varying, 'BRONZE'::character varying, 'PLATINUM'::character varying])::text[])))
boards boards_dimensions_check (((dimensions)::text ~ '^((\d+) |(\d+\/\d+) |(\d+) (\d+\/\d+) )x( (\d+)| (\d+\/\d+)| (\d+) (\d+\/\d+))$'::text))
boards boards_thickness_check ((thickness > 0))
boards boards_valid_id_check ((board_id ~ '^BOARD-\d{2}$'::text))
boxes boxes_id_check ((box_id ~ '^BOX-\d{2}$'::text))
boxes boxes_size_check (((size)::text = ANY ((ARRAY['SHORT'::character varying, 'LONG'::character varying])::text[])))
boxes boxes_type_check (((type)::text = ANY ((ARRAY['PHYSICAL'::character varying, 'VIRTUAL'::character varying])::text[])))
tags tags_tag_id_check ((tag_id ~ '^TAG-[0-9]{3}$'::text))