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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
1719b1b3
Commit
1719b1b3
authored
Jan 26, 2018
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve structure of lfs_file_locks table
parent
1d0ecbd4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
8 deletions
+7
-8
app/services/lfs/lock_file_service.rb
app/services/lfs/lock_file_service.rb
+1
-1
db/migrate/20180116193854_create_lfs_file_locks.rb
db/migrate/20180116193854_create_lfs_file_locks.rb
+3
-3
db/schema.rb
db/schema.rb
+2
-3
spec/ee/requests/projects/path_locks_controller_spec.rb
spec/ee/requests/projects/path_locks_controller_spec.rb
+0
-0
spec/requests/lfs_locks_api_spec.rb
spec/requests/lfs_locks_api_spec.rb
+1
-1
No files found.
app/services/lfs/lock_file_service.rb
View file @
1719b1b3
...
...
@@ -9,7 +9,7 @@ module Lfs
create_lock!
rescue
ActiveRecord
::
RecordNotUnique
error
(
'already
created lock
'
,
409
,
current_lock
)
error
(
'already
locked
'
,
409
,
current_lock
)
rescue
Gitlab
::
GitAccess
::
UnauthorizedError
=>
ex
error
(
ex
.
message
,
403
)
rescue
=>
ex
...
...
db/migrate/20180116193854_create_lfs_file_locks.rb
View file @
1719b1b3
...
...
@@ -3,12 +3,12 @@ class CreateLfsFileLocks < ActiveRecord::Migration
def
change
create_table
:lfs_file_locks
do
|
t
|
t
.
references
:project
,
null:
false
,
index:
true
,
foreign_key:
{
on_delete: :cascade
}
t
.
references
:project
,
null:
false
,
foreign_key:
{
on_delete: :cascade
}
t
.
references
:user
,
null:
false
,
index:
true
,
foreign_key:
{
on_delete: :cascade
}
t
.
string
:path
t
.
datetime
:created_at
,
null:
false
t
.
string
:path
,
limit:
65500
end
add_index
:lfs_file_locks
,
[
:p
ath
,
:project_id
],
unique:
true
add_index
:lfs_file_locks
,
[
:p
roject_id
,
:path
],
unique:
true
end
end
db/schema.rb
View file @
1719b1b3
...
...
@@ -1305,12 +1305,11 @@ ActiveRecord::Schema.define(version: 20180204200836) do
create_table
"lfs_file_locks"
,
force: :cascade
do
|
t
|
t
.
integer
"project_id"
,
null:
false
t
.
integer
"user_id"
,
null:
false
t
.
string
"path"
t
.
datetime
"created_at"
,
null:
false
t
.
string
"path"
,
limit:
65500
end
add_index
"lfs_file_locks"
,
[
"path"
,
"project_id"
],
name:
"index_lfs_file_locks_on_path_and_project_id"
,
unique:
true
,
using: :btree
add_index
"lfs_file_locks"
,
[
"project_id"
],
name:
"index_lfs_file_locks_on_project_id"
,
using: :btree
add_index
"lfs_file_locks"
,
[
"project_id"
,
"path"
],
name:
"index_lfs_file_locks_on_project_id_and_path"
,
unique:
true
,
using: :btree
add_index
"lfs_file_locks"
,
[
"user_id"
],
name:
"index_lfs_file_locks_on_user_id"
,
using: :btree
create_table
"lfs_objects"
,
force: :cascade
do
|
t
|
...
...
spec/ee/requests/projects/path_locks_spec.rb
→
spec/ee/requests/projects/path_locks_
controller_
spec.rb
View file @
1719b1b3
File moved
spec/requests/lfs_locks_api_spec.rb
View file @
1719b1b3
...
...
@@ -52,7 +52,7 @@ describe 'Git LFS File Locking API' do
expect
(
response
).
to
have_gitlab_http_status
(
409
)
expect
(
json_response
.
keys
).
to
match_array
(
%w(lock message documentation_url)
)
expect
(
json_response
[
'message'
]).
to
match
(
/already
created lock
/
)
expect
(
json_response
[
'message'
]).
to
match
(
/already
locked
/
)
end
it
'returns the existen lock'
do
...
...
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