Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
57ccff8e
Commit
57ccff8e
authored
Jul 20, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use db's on_delete instead of has_many :dependent
parent
786b5a59
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
8 deletions
+8
-8
app/models/gpg_key.rb
app/models/gpg_key.rb
+1
-1
app/models/user.rb
app/models/user.rb
+1
-1
db/migrate/20170222111732_create_gpg_keys.rb
db/migrate/20170222111732_create_gpg_keys.rb
+1
-1
db/migrate/20170613154149_create_gpg_signatures.rb
db/migrate/20170613154149_create_gpg_signatures.rb
+2
-2
db/schema.rb
db/schema.rb
+3
-3
No files found.
app/models/gpg_key.rb
View file @
57ccff8e
...
...
@@ -7,7 +7,7 @@ class GpgKey < ActiveRecord::Base
sha_attribute
:fingerprint
belongs_to
:user
has_many
:gpg_signatures
,
dependent: :nullify
has_many
:gpg_signatures
validates
:user
,
presence:
true
...
...
app/models/user.rb
View file @
57ccff8e
...
...
@@ -76,7 +76,7 @@ class User < ActiveRecord::Base
where
(
type
.
not_eq
(
'DeployKey'
).
or
(
type
.
eq
(
nil
)))
end
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_many
:deploy_keys
,
->
{
where
(
type:
'DeployKey'
)
},
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_many
:gpg_keys
,
dependent: :destroy
has_many
:gpg_keys
has_many
:emails
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_many
:personal_access_tokens
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
...
...
db/migrate/20170222111732_create_gpg_keys.rb
View file @
57ccff8e
...
...
@@ -5,7 +5,7 @@ class CreateGpgKeys < ActiveRecord::Migration
create_table
:gpg_keys
do
|
t
|
t
.
timestamps_with_timezone
null:
false
t
.
references
:user
,
index:
true
,
foreign_key:
true
t
.
references
:user
,
index:
true
,
foreign_key:
{
on_delete: :cascade
}
t
.
binary
:primary_keyid
,
limit:
Gitlab
::
Database
.
mysql?
?
20
:
nil
t
.
binary
:fingerprint
,
limit:
Gitlab
::
Database
.
mysql?
?
20
:
nil
...
...
db/migrate/20170613154149_create_gpg_signatures.rb
View file @
57ccff8e
...
...
@@ -5,8 +5,8 @@ class CreateGpgSignatures < ActiveRecord::Migration
create_table
:gpg_signatures
do
|
t
|
t
.
timestamps_with_timezone
null:
false
t
.
references
:project
,
index:
true
,
foreign_key:
true
t
.
references
:gpg_key
,
index:
true
,
foreign_key:
true
t
.
references
:project
,
index:
true
,
foreign_key:
{
on_delete: :cascade
}
t
.
references
:gpg_key
,
index:
true
,
foreign_key:
{
on_delete: :nullify
}
t
.
boolean
:valid_signature
...
...
db/schema.rb
View file @
57ccff8e
...
...
@@ -1631,9 +1631,9 @@ ActiveRecord::Schema.define(version: 20170725145659) do
add_foreign_key
"environments"
,
"projects"
,
name:
"fk_d1c8c1da6a"
,
on_delete: :cascade
add_foreign_key
"events"
,
"projects"
,
name:
"fk_0434b48643"
,
on_delete: :cascade
add_foreign_key
"forked_project_links"
,
"projects"
,
column:
"forked_to_project_id"
,
name:
"fk_434510edb0"
,
on_delete: :cascade
add_foreign_key
"gpg_keys"
,
"users"
add_foreign_key
"gpg_signatures"
,
"gpg_keys"
add_foreign_key
"gpg_signatures"
,
"projects"
add_foreign_key
"gpg_keys"
,
"users"
,
on_delete: :cascade
add_foreign_key
"gpg_signatures"
,
"gpg_keys"
,
on_delete: :nullify
add_foreign_key
"gpg_signatures"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"issue_assignees"
,
"issues"
,
name:
"fk_b7d881734a"
,
on_delete: :cascade
add_foreign_key
"issue_assignees"
,
"users"
,
name:
"fk_5e0c8d9154"
,
on_delete: :cascade
add_foreign_key
"issue_metrics"
,
"issues"
,
on_delete: :cascade
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment