Skip to content
Snippets Groups Projects
Commit 6a53cb3e authored by vlorentz's avatar vlorentz
Browse files

pg: Check revision.extra_headers is not null.

Fixes a regression in 038a219f,
as it made the converter expect a list.

When adding this column, we made it default to null instead of defaulting
to an empty array, so existing records were initialized will null.

This commit migrates these nulls to empty arrays, then adds a constraint
to enforce it in the future.
parent ca3ee92d
No related branches found
No related tags found
1 merge request!540pg: Check revision.extra_headers is not null.
-- SWH DB schema upgrade
-- from_version: 160
-- to_version: 161
-- description: Make revision.extra_headers not null
-- latest schema version
insert into dbversion(version, release, description)
values(161, now(), 'Work Still In Progress');
update revision
set extra_headers = ARRAY[][]
where extra_headers is null;
alter table revision
alter column extra_headers set not null;
......@@ -17,7 +17,7 @@ comment on column dbversion.description is 'Release description';
-- latest schema version
insert into dbversion(version, release, description)
values(160, now(), 'Work In Progress');
values(161, now(), 'Work In Progress');
-- a SHA1 checksum
create domain sha1 as bytea check (length(value) = 20);
......@@ -240,7 +240,7 @@ create table revision
object_id bigserial,
date_neg_utc_offset boolean,
committer_date_neg_utc_offset boolean,
extra_headers bytea[][] -- extra headers (used in hash computation)
extra_headers bytea[][] not null -- extra headers (used in hash computation)
);
comment on table revision is 'A revision represents the state of a source code tree at a specific point in time';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment