Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-scrubber
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Antoine Lambert
swh-scrubber
Commits
36d16bcd
Commit
36d16bcd
authored
2 years ago
by
vlorentz
Browse files
Options
Downloads
Patches
Plain Diff
Add missing DB version 3
parent
53830b24
No related branches found
Branches containing commit
Tags
v0.1.0
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
swh/scrubber/db.py
+1
-1
1 addition, 1 deletion
swh/scrubber/db.py
swh/scrubber/sql/upgrades/3.sql
+43
-0
43 additions, 0 deletions
swh/scrubber/sql/upgrades/3.sql
with
44 additions
and
1 deletion
swh/scrubber/db.py
+
1
−
1
View file @
36d16bcd
...
...
@@ -60,7 +60,7 @@ class FixedObject:
class
ScrubberDb
(
BaseDb
):
current_version
=
2
current_version
=
3
####################################
# Shared tables
...
...
This diff is collapsed.
Click to expand it.
swh/scrubber/sql/upgrades/3.sql
0 → 100644
+
43
−
0
View file @
36d16bcd
-- SWH Scrubber DB schema upgrade
-- from_version: 2
-- to_version: 3
-- description: Add missing_object
create
table
missing_object
(
id
swhid
not
null
,
datastore
int
not
null
,
first_occurrence
timestamptz
not
null
default
now
()
);
comment
on
table
missing_object
is
'Each row identifies an object that are missing but referenced by another object (aka "holes")'
;
comment
on
column
missing_object
.
datastore
is
'Datastore where the hole is.'
;
comment
on
column
missing_object
.
first_occurrence
is
'Moment the object was found to be corrupt for the first time'
;
create
table
missing_object_reference
(
missing_id
swhid
not
null
,
reference_id
swhid
not
null
,
datastore
int
not
null
,
first_occurrence
timestamptz
not
null
default
now
()
);
comment
on
table
missing_object_reference
is
'Each row identifies an object that points to an object that does not exist (aka a "hole")'
;
comment
on
column
missing_object_reference
.
missing_id
is
'SWHID of the missing object.'
;
comment
on
column
missing_object_reference
.
reference_id
is
'SWHID of the object referencing the missing object.'
;
comment
on
column
missing_object_reference
.
datastore
is
'Datastore where the referencing object is.'
;
comment
on
column
missing_object_reference
.
first_occurrence
is
'Moment the object was found to reference a missing object'
;
alter
table
missing_object
add
constraint
missing_object_datastore_fkey
foreign
key
(
datastore
)
references
datastore
(
id
)
not
valid
;
alter
table
missing_object
validate
constraint
missing_object_datastore_fkey
;
create
unique
index
concurrently
missing_object_pkey
on
missing_object
(
id
,
datastore
);
alter
table
missing_object
add
primary
key
using
index
missing_object_pkey
;
alter
table
missing_object_reference
add
constraint
missing_object_reference_datastore_fkey
foreign
key
(
datastore
)
references
datastore
(
id
)
not
valid
;
alter
table
missing_object_reference
validate
constraint
missing_object_reference_datastore_fkey
;
create
unique
index
concurrently
missing_object_reference_missing_id_reference_id_datastore
on
missing_object_reference
(
missing_id
,
reference_id
,
datastore
);
create
unique
index
concurrently
missing_object_reference_reference_id_missing_id_datastore
on
missing_object_reference
(
reference_id
,
missing_id
,
datastore
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment