Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Mastodon
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Mastodon
Commits
83a98cb8
Commit
83a98cb8
authored
5 months ago
by
Claire
Browse files
Options
Downloads
Patches
Plain Diff
Add missing `on_delete: :cascade` on `notification_permissions` (#32281)
parent
889edc56
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
db/migrate/20241007071624_fix_notification_permission_foreign_keys.rb
+39
-0
39 additions, 0 deletions
...0241007071624_fix_notification_permission_foreign_keys.rb
db/schema.rb
+3
-3
3 additions, 3 deletions
db/schema.rb
with
42 additions
and
3 deletions
db/migrate/20241007071624_fix_notification_permission_foreign_keys.rb
0 → 100644
+
39
−
0
View file @
83a98cb8
# frozen_string_literal: true
class
FixNotificationPermissionForeignKeys
<
ActiveRecord
::
Migration
[
7.1
]
def
up
safety_assured
do
execute
<<~
SQL
.
squish
ALTER TABLE notification_permissions
DROP CONSTRAINT fk_rails_7c0bed08df,
ADD CONSTRAINT fk_rails_7c0bed08df
FOREIGN KEY (account_id)
REFERENCES accounts(id)
ON DELETE CASCADE,
DROP CONSTRAINT fk_rails_e3e0aaad70,
ADD CONSTRAINT fk_rails_e3e0aaad70
FOREIGN KEY (from_account_id)
REFERENCES accounts(id)
ON DELETE CASCADE
SQL
end
end
def
down
safety_assured
do
execute
<<~
SQL
.
squish
ALTER TABLE notification_permissions
DROP CONSTRAINT fk_rails_7c0bed08df,
ADD CONSTRAINT fk_rails_7c0bed08df
FOREIGN KEY (account_id)
REFERENCES accounts(id),
DROP CONSTRAINT fk_rails_e3e0aaad70,
ADD CONSTRAINT fk_rails_e3e0aaad70
FOREIGN KEY (from_account_id)
REFERENCES accounts(id)
SQL
end
end
end
This diff is collapsed.
Click to expand it.
db/schema.rb
+
3
−
3
View file @
83a98cb8
...
...
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
[
7.1
].
define
(
version:
2024_
09_16_190140
)
do
ActiveRecord
::
Schema
[
7.1
].
define
(
version:
2024_
10_07_071624
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -1291,8 +1291,8 @@ ActiveRecord::Schema[7.1].define(version: 2024_09_16_190140) do
add_foreign_key
"mentions"
,
"statuses"
,
on_delete: :cascade
add_foreign_key
"mutes"
,
"accounts"
,
column:
"target_account_id"
,
name:
"fk_eecff219ea"
,
on_delete: :cascade
add_foreign_key
"mutes"
,
"accounts"
,
name:
"fk_b8d8daf315"
,
on_delete: :cascade
add_foreign_key
"notification_permissions"
,
"accounts"
add_foreign_key
"notification_permissions"
,
"accounts"
,
column:
"from_account_id"
add_foreign_key
"notification_permissions"
,
"accounts"
,
column:
"from_account_id"
,
on_delete: :cascade
add_foreign_key
"notification_permissions"
,
"accounts"
,
on_delete: :cascade
add_foreign_key
"notification_policies"
,
"accounts"
,
on_delete: :cascade
add_foreign_key
"notification_requests"
,
"accounts"
,
column:
"from_account_id"
,
on_delete: :cascade
add_foreign_key
"notification_requests"
,
"accounts"
,
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