Commit 1719b1b3 authored by Rubén Dávila's avatar Rubén Dávila

Improve structure of lfs_file_locks table

parent 1d0ecbd4
......@@ -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
......
......@@ -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, [:path, :project_id], unique: true
add_index :lfs_file_locks, [:project_id, :path], unique: true
end
end
......@@ -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|
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment