Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9125680
130.sql
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
130.sql
View Options
-- SWH Indexer DB schema upgrade
-- from_version: 129
-- to_version: 130
-- description:
insert
into
dbversion
(
version
,
release
,
description
)
values
(
130
,
now
(),
'Work In Progress'
);
create
or
replace
function
swh_content_fossology_license_add
(
conflict_update
boolean
)
returns
void
language
plpgsql
as
$$
begin
-- insert unknown licenses first
insert
into
fossology_license
(
name
)
select
distinct
license
from
tmp_content_fossology_license
tmp
where
not
exists
(
select
1
from
fossology_license
where
name
=
tmp
.
license
)
on
conflict
(
name
)
do
nothing
;
if
conflict_update
then
insert
into
content_fossology_license
(
id
,
license_id
,
indexer_configuration_id
)
select
tcl
.
id
,
(
select
id
from
fossology_license
where
name
=
tcl
.
license
)
as
license
,
indexer_configuration_id
from
tmp_content_fossology_license
tcl
on
conflict
(
id
,
license_id
,
indexer_configuration_id
)
do
update
set
license_id
=
excluded
.
license_id
;
return
;
end
if
;
insert
into
content_fossology_license
(
id
,
license_id
,
indexer_configuration_id
)
select
tcl
.
id
,
(
select
id
from
fossology_license
where
name
=
tcl
.
license
)
as
license
,
indexer_configuration_id
from
tmp_content_fossology_license
tcl
on
conflict
(
id
,
license_id
,
indexer_configuration_id
)
do
nothing
;
return
;
end
$$
;
comment
on
function
swh_content_fossology_license_add
(
boolean
)
IS
'Add new content licenses'
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jun 21, 9:12 PM (4 w, 11 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3240113
Attached To
rDCIDX Metadata indexer
Event Timeline
Log In to Comment