Page MenuHomeSoftware Heritage

D3170.id11263.diff
No OneTemporary

D3170.id11263.diff

diff --git a/sql/upgrades/150.sql b/sql/upgrades/150.sql
new file mode 100644
--- /dev/null
+++ b/sql/upgrades/150.sql
@@ -0,0 +1,19 @@
+-- SWH DB schema upgrade
+-- from_version: 149
+-- to_version: 150
+-- description: Add not null values with default values
+
+update metadata_authority
+set metadata='{}'::jsonb where metadata is null;
+
+alter table metadata_authority
+ alter column metadata set not null;
+
+alter table origin_metadata
+ alter column format set not null;
+
+alter table origin_metadata
+ alter column format set default 'sword-v2-atom-codemeta-v2-in-json';
+
+alter table origin_metadata
+ alter column metadata set not null;
diff --git a/swh/storage/sql/30-swh-schema.sql b/swh/storage/sql/30-swh-schema.sql
--- a/swh/storage/sql/30-swh-schema.sql
+++ b/swh/storage/sql/30-swh-schema.sql
@@ -17,7 +17,7 @@
-- latest schema version
insert into dbversion(version, release, description)
- values(149, now(), 'Work In Progress');
+ values(150, now(), 'Work In Progress');
-- a SHA1 checksum
create domain sha1 as bytea check (length(value) = 20);
@@ -417,7 +417,7 @@
id serial not null,
type text not null,
url text not null,
- metadata jsonb
+ metadata jsonb not null
);
comment on table metadata_authority is 'Metadata authority information';
@@ -436,8 +436,8 @@
discovery_date timestamptz not null, -- when it was extracted
authority_id bigint not null,
fetcher_id bigint not null,
- format text default 'sword-v2-atom-codemeta-v2-in-json',
- metadata bytea
+ format text not null default 'sword-v2-atom-codemeta-v2-in-json',
+ metadata bytea not null
);
comment on table origin_metadata is 'keeps all metadata found concerning an origin';

File Metadata

Mime Type
text/plain
Expires
Sun, Aug 17, 10:56 PM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3220679

Event Timeline