Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/sql/60-indexes.sql
Show First 20 Lines • Show All 118 Lines • ▼ Show 20 Lines | \if :dbflavor_does_deduplication | ||||
alter table revision validate constraint revision_author_fkey; | alter table revision validate constraint revision_author_fkey; | ||||
alter table revision add constraint revision_committer_fkey foreign key (committer) references person(id) not valid; | alter table revision add constraint revision_committer_fkey foreign key (committer) references person(id) not valid; | ||||
alter table revision validate constraint revision_committer_fkey; | alter table revision validate constraint revision_committer_fkey; | ||||
alter table revision | alter table revision | ||||
add constraint revision_date_neg_utc_offset_not_null | add constraint revision_date_neg_utc_offset_not_null | ||||
check (date is null or date_neg_utc_offset is not null) | check (date is null or date_neg_utc_offset is not null) | ||||
not valid; | not valid; | ||||
alter table revision | alter table revision | ||||
add constraint revision_committer_date_neg_utc_offset_not_null | add constraint revision_committer_date_neg_utc_offset_not_null | ||||
check (committer_date is null or committer_date_neg_utc_offset is not null) | check (committer_date is null or committer_date_neg_utc_offset is not null) | ||||
not valid; | not valid; | ||||
alter table revision | alter table revision | ||||
add constraint revision_date_offset_not_null | |||||
check (date is null or date_offset_bytes is not null) | |||||
not valid; | |||||
alter table revision | |||||
add constraint revision_committer_date_offset_not_null | |||||
check (committer_date is null or committer_date_offset_bytes is not null) | |||||
not valid; | |||||
alter table revision | |||||
validate constraint revision_date_neg_utc_offset_not_null; | validate constraint revision_date_neg_utc_offset_not_null; | ||||
alter table revision | alter table revision | ||||
validate constraint revision_committer_date_neg_utc_offset_not_null; | validate constraint revision_committer_date_neg_utc_offset_not_null; | ||||
alter table revision | |||||
validate constraint revision_date_offset_not_null; | |||||
alter table revision | |||||
validate constraint revision_committer_date_offset_not_null; | |||||
\endif | \endif | ||||
\if :dbflavor_default | \if :dbflavor_default | ||||
create index concurrently on revision(directory); -- to be reviewed | create index concurrently on revision(directory); -- to be reviewed | ||||
create unique index concurrently on revision(object_id); -- to be reviewed | create unique index concurrently on revision(object_id); -- to be reviewed | ||||
\endif | \endif | ||||
-- revision_history | -- revision_history | ||||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | \if :dbflavor_does_deduplication | ||||
alter table release validate constraint release_author_fkey; | alter table release validate constraint release_author_fkey; | ||||
alter table release | alter table release | ||||
add constraint release_date_neg_utc_offset_not_null | add constraint release_date_neg_utc_offset_not_null | ||||
check (date is null or date_neg_utc_offset is not null) | check (date is null or date_neg_utc_offset is not null) | ||||
not valid; | not valid; | ||||
alter table release | alter table release | ||||
add constraint release_date_offset_not_null | |||||
check (date is null or date_offset_bytes is not null) | |||||
not valid; | |||||
alter table release | |||||
validate constraint release_date_neg_utc_offset_not_null; | validate constraint release_date_neg_utc_offset_not_null; | ||||
alter table release | |||||
validate constraint release_date_offset_not_null; | |||||
-- if the author is null, then the date must be null | -- if the author is null, then the date must be null | ||||
alter table release add constraint release_author_date_check check ((date is null) or (author is not null)) not valid; | alter table release add constraint release_author_date_check check ((date is null) or (author is not null)) not valid; | ||||
alter table release validate constraint release_author_date_check; | alter table release validate constraint release_author_date_check; | ||||
\endif | \endif | ||||
-- metadata_fetcher | -- metadata_fetcher | ||||
create unique index metadata_fetcher_pkey on metadata_fetcher(id); | create unique index metadata_fetcher_pkey on metadata_fetcher(id); | ||||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |