Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9346250
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
View Options
diff --git a/sql/upgrades/136.sql b/sql/upgrades/136.sql
index a409e17e..7ae228fa 100644
--- a/sql/upgrades/136.sql
+++ b/sql/upgrades/136.sql
@@ -1,41 +1,41 @@
-- SWH DB schema upgrade
-- from_version: 135
-- to_version: 136
-- description: Add a 'type' column to the origin_visit table.
insert into dbversion(version, release, description)
values(136, now(), 'Work In Progress');
-- Stop swh-storage first
alter table origin_visit
add column type text;
comment on column origin_visit.type is 'Type of loader that did the visit (hg, git, ...)';
create or replace function swh_origin_visit_add(origin_id bigint, date timestamptz, type text)
returns bigint
language sql
as $$
with last_known_visit as (
select coalesce(max(visit), 0) as visit
from origin_visit
where origin = origin_id
)
insert into origin_visit (origin, date, type, visit, status)
values (origin_id, date, type, (select visit from last_known_visit) + 1, 'ongoing')
returning visit;
$$;
-- Start swh-storage here
update origin_visit
- set origin_visit.type = origin.type
+ set type = origin.type
from origin
where origin_visit.origin = origin.id;
alter table origin_visit
alter column type text set not null;
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Fri, Jul 4, 3:50 PM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3261465
Attached To
rDSTO Storage manager
Event Timeline
Log In to Comment