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
328f4a50
Commit
328f4a50
authored
Sep 27, 2017
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a separate model to handle GPG subkeys
parent
37dcfb6e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
12 deletions
+22
-12
app/models/gpg_key.rb
app/models/gpg_key.rb
+1
-1
app/models/gpg_key_subkey.rb
app/models/gpg_key_subkey.rb
+3
-0
db/migrate/20170926050624_add_parent_id_to_gpg_keys.rb
db/migrate/20170926050624_add_parent_id_to_gpg_keys.rb
+0
-10
db/migrate/20170927161718_create_gpg_key_subkeys.rb
db/migrate/20170927161718_create_gpg_key_subkeys.rb
+9
-0
db/schema.rb
db/schema.rb
+9
-1
No files found.
app/models/gpg_key.rb
View file @
328f4a50
...
@@ -10,7 +10,7 @@ class GpgKey < ActiveRecord::Base
...
@@ -10,7 +10,7 @@ class GpgKey < ActiveRecord::Base
belongs_to
:user
belongs_to
:user
belongs_to
:parent
,
class_name:
'GpgKey'
belongs_to
:parent
,
class_name:
'GpgKey'
has_many
:gpg_signatures
has_many
:gpg_signatures
has_many
:subkeys
,
class_name:
'GpgKey
'
,
foreign_key: :parent_id
,
dependent: :destroy
has_many
:subkeys
,
class_name:
'GpgKey
Subkey'
validates
:user
,
presence:
true
validates
:user
,
presence:
true
...
...
app/models/gpg_key_subkey.rb
0 → 100644
View file @
328f4a50
class
GpgKeySubkey
<
ActiveRecord
::
Base
belongs_to
:gpg_key
end
db/migrate/20170926050624_add_parent_id_to_gpg_keys.rb
deleted
100644 → 0
View file @
37dcfb6e
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
AddParentIdToGpgKeys
<
ActiveRecord
::
Migration
DOWNTIME
=
false
def
change
add_column
:gpg_keys
,
:parent_id
,
:integer
end
end
db/migrate/20170927161718_create_gpg_key_subkeys.rb
0 → 100644
View file @
328f4a50
class
CreateGpgKeySubkeys
<
ActiveRecord
::
Migration
def
change
create_table
:gpg_key_subkeys
do
|
t
|
t
.
binary
:keyid
t
.
binary
:fingerprint
t
.
references
:gpg_key
,
null:
false
,
index:
true
,
foreign_key:
{
on_delete: :cascade
}
end
end
end
db/schema.rb
View file @
328f4a50
...
@@ -579,6 +579,14 @@ ActiveRecord::Schema.define(version: 20171004121444) do
...
@@ -579,6 +579,14 @@ ActiveRecord::Schema.define(version: 20171004121444) do
add_index
"forked_project_links"
,
[
"forked_to_project_id"
],
name:
"index_forked_project_links_on_forked_to_project_id"
,
unique:
true
,
using: :btree
add_index
"forked_project_links"
,
[
"forked_to_project_id"
],
name:
"index_forked_project_links_on_forked_to_project_id"
,
unique:
true
,
using: :btree
create_table
"gpg_key_subkeys"
,
force: :cascade
do
|
t
|
t
.
binary
"keyid"
t
.
binary
"fingerprint"
t
.
integer
"gpg_key_id"
,
null:
false
end
add_index
"gpg_key_subkeys"
,
[
"gpg_key_id"
],
name:
"index_gpg_key_subkeys_on_gpg_key_id"
,
using: :btree
create_table
"gpg_keys"
,
force: :cascade
do
|
t
|
create_table
"gpg_keys"
,
force: :cascade
do
|
t
|
t
.
datetime_with_timezone
"created_at"
,
null:
false
t
.
datetime_with_timezone
"created_at"
,
null:
false
t
.
datetime_with_timezone
"updated_at"
,
null:
false
t
.
datetime_with_timezone
"updated_at"
,
null:
false
...
@@ -586,7 +594,6 @@ ActiveRecord::Schema.define(version: 20171004121444) do
...
@@ -586,7 +594,6 @@ ActiveRecord::Schema.define(version: 20171004121444) do
t
.
binary
"primary_keyid"
t
.
binary
"primary_keyid"
t
.
binary
"fingerprint"
t
.
binary
"fingerprint"
t
.
text
"key"
t
.
text
"key"
t
.
integer
"parent_id"
end
end
add_index
"gpg_keys"
,
[
"fingerprint"
],
name:
"index_gpg_keys_on_fingerprint"
,
unique:
true
,
using: :btree
add_index
"gpg_keys"
,
[
"fingerprint"
],
name:
"index_gpg_keys_on_fingerprint"
,
unique:
true
,
using: :btree
...
@@ -1727,6 +1734,7 @@ ActiveRecord::Schema.define(version: 20171004121444) do
...
@@ -1727,6 +1734,7 @@ ActiveRecord::Schema.define(version: 20171004121444) do
add_foreign_key
"events"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"events"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"events"
,
"users"
,
column:
"author_id"
,
name:
"fk_edfd187b6f"
,
on_delete: :cascade
add_foreign_key
"events"
,
"users"
,
column:
"author_id"
,
name:
"fk_edfd187b6f"
,
on_delete: :cascade
add_foreign_key
"forked_project_links"
,
"projects"
,
column:
"forked_to_project_id"
,
name:
"fk_434510edb0"
,
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_key_subkeys"
,
"gpg_keys"
,
on_delete: :cascade
add_foreign_key
"gpg_keys"
,
"users"
,
on_delete: :cascade
add_foreign_key
"gpg_keys"
,
"users"
,
on_delete: :cascade
add_foreign_key
"gpg_signatures"
,
"gpg_keys"
,
on_delete: :nullify
add_foreign_key
"gpg_signatures"
,
"gpg_keys"
,
on_delete: :nullify
add_foreign_key
"gpg_signatures"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"gpg_signatures"
,
"projects"
,
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