Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-vault
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
Model registry
Operate
Environments
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
Platform
Development
swh-vault
Commits
77d8dc98
Commit
77d8dc98
authored
6 years ago
by
Antoine Pietri
Browse files
Options
Downloads
Patches
Plain Diff
schema: add delete cascade constraints to foreign keys
parent
06658e14
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!25
schema: add delete cascade constraints to foreign keys
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sql/swh-vault-schema.sql
+3
-3
3 additions, 3 deletions
sql/swh-vault-schema.sql
sql/upgrades/003.sql
+28
-0
28 additions, 0 deletions
sql/upgrades/003.sql
with
31 additions
and
3 deletions
sql/swh-vault-schema.sql
+
3
−
3
View file @
77d8dc98
...
...
@@ -40,7 +40,7 @@ create index concurrently vault_bundle_task_id
create
table
vault_notif_email
(
id
bigserial
primary
key
,
email
text
not
null
,
-- e-mail to notify
bundle_id
bigint
not
null
references
vault_bundle
(
id
)
bundle_id
bigint
not
null
references
vault_bundle
(
id
)
on
delete
cascade
);
create
index
concurrently
vault_notif_email_bundle
on
vault_notif_email
(
bundle_id
);
...
...
@@ -52,8 +52,8 @@ create table vault_batch (
);
create
table
vault_batch_bundle
(
batch_id
bigint
not
null
references
vault_batch
(
id
),
bundle_id
bigint
not
null
references
vault_bundle
(
id
)
batch_id
bigint
not
null
references
vault_batch
(
id
)
on
delete
cascade
,
bundle_id
bigint
not
null
references
vault_bundle
(
id
)
on
delete
cascade
);
create
unique
index
concurrently
vault_batch_bundle_pkey
on
vault_batch_bundle
(
batch_id
,
bundle_id
);
This diff is collapsed.
Click to expand it.
sql/upgrades/003.sql
0 → 100644
+
28
−
0
View file @
77d8dc98
-- SWH DB schema upgrade
-- from_version: 002
-- to_version: 003
-- description: Add delete cascade conditions
insert
into
dbversion
(
version
,
release
,
description
)
values
(
3
,
now
(),
'Add delete cascade conditions'
);
alter
table
vault_notif_email
drop
constraint
"vault_notif_email_bundle_id_fkey"
,
add
constraint
"vault_notif_email_bundle_id_fkey"
foreign
key
(
bundle_id
)
references
vault_bundle
on
delete
cascade
;
alter
table
vault_batch_bundle
drop
constraint
"vault_batch_bundle_bundle_id_fkey"
,
add
constraint
"vault_batch_bundle_bundle_id_fkey"
foreign
key
(
bundle_id
)
references
vault_bundle
on
delete
cascade
;
alter
table
vault_batch_bundle
drop
constraint
"vault_batch_bundle_batch_id_fkey"
,
add
constraint
"vault_batch_bundle_batch_id_fkey"
foreign
key
(
batch_id
)
references
vault_batch
on
delete
cascade
;
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