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
Léo-Paul Géneau
gitlab-ce
Commits
ed4c7190
Commit
ed4c7190
authored
Mar 06, 2015
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix importers with OCC
parent
e0caed91
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
14 deletions
+21
-14
app/controllers/import/base_controller.rb
app/controllers/import/base_controller.rb
+8
-10
db/migrate/20150306023112_add_unique_index_to_namespace.rb
db/migrate/20150306023112_add_unique_index_to_namespace.rb
+9
-0
db/schema.rb
db/schema.rb
+4
-4
No files found.
app/controllers/import/base_controller.rb
View file @
ed4c7190
...
@@ -3,19 +3,17 @@ class Import::BaseController < ApplicationController
...
@@ -3,19 +3,17 @@ class Import::BaseController < ApplicationController
private
private
def
get_or_create_namespace
def
get_or_create_namespace
existing_namespace
=
Namespace
.
find_by_path_or_name
(
@target_namespace
)
begin
namespace
=
Group
.
create!
(
name:
@target_namespace
,
path:
@target_namespace
,
owner:
current_user
)
if
existing_namespace
namespace
.
add_owner
(
current_user
)
if
existing_namespace
.
owner
==
current_user
rescue
ActiveRecord
::
RecordNotUnique
,
ActiveRecord
::
RecordInvalid
namespace
=
existing_namespace
namespace
=
Namespace
.
find_by_path_or_name
(
@target_namespace
)
else
unless
namespace
.
owner
==
current_user
@already_been_taken
=
true
@already_been_taken
=
true
return
false
return
false
end
end
else
namespace
=
Group
.
create
(
name:
@target_namespace
,
path:
@target_namespace
,
owner:
current_user
)
namespace
.
add_owner
(
current_user
)
namespace
end
end
namespace
end
end
end
end
db/migrate/20150306023112_add_unique_index_to_namespace.rb
0 → 100644
View file @
ed4c7190
class
AddUniqueIndexToNamespace
<
ActiveRecord
::
Migration
def
change
remove_index
:namespaces
,
:name
remove_index
:namespaces
,
:path
add_index
:namespaces
,
:name
,
unique:
true
add_index
:namespaces
,
:path
,
unique:
true
end
end
db/schema.rb
View file @
ed4c7190
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#
#
# It's strongly recommended that you check this file into your version control system.
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
20150
225065047
)
do
ActiveRecord
::
Schema
.
define
(
version:
20150
306023112
)
do
# These are extensions that must be enabled in order to support this database
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
enable_extension
"plpgsql"
...
@@ -242,9 +242,9 @@ ActiveRecord::Schema.define(version: 20150225065047) do
...
@@ -242,9 +242,9 @@ ActiveRecord::Schema.define(version: 20150225065047) do
end
end
add_index
"namespaces"
,
[
"created_at"
,
"id"
],
name:
"index_namespaces_on_created_at_and_id"
,
using: :btree
add_index
"namespaces"
,
[
"created_at"
,
"id"
],
name:
"index_namespaces_on_created_at_and_id"
,
using: :btree
add_index
"namespaces"
,
[
"name"
],
name:
"index_namespaces_on_name"
,
using: :btree
add_index
"namespaces"
,
[
"name"
],
name:
"index_namespaces_on_name"
,
u
nique:
true
,
u
sing: :btree
add_index
"namespaces"
,
[
"owner_id"
],
name:
"index_namespaces_on_owner_id"
,
using: :btree
add_index
"namespaces"
,
[
"owner_id"
],
name:
"index_namespaces_on_owner_id"
,
using: :btree
add_index
"namespaces"
,
[
"path"
],
name:
"index_namespaces_on_path"
,
using: :btree
add_index
"namespaces"
,
[
"path"
],
name:
"index_namespaces_on_path"
,
u
nique:
true
,
u
sing: :btree
add_index
"namespaces"
,
[
"type"
],
name:
"index_namespaces_on_type"
,
using: :btree
add_index
"namespaces"
,
[
"type"
],
name:
"index_namespaces_on_type"
,
using: :btree
create_table
"notes"
,
force:
true
do
|
t
|
create_table
"notes"
,
force:
true
do
|
t
|
...
@@ -334,12 +334,12 @@ ActiveRecord::Schema.define(version: 20150225065047) do
...
@@ -334,12 +334,12 @@ ActiveRecord::Schema.define(version: 20150225065047) do
t
.
string
"import_url"
t
.
string
"import_url"
t
.
integer
"visibility_level"
,
default:
0
,
null:
false
t
.
integer
"visibility_level"
,
default:
0
,
null:
false
t
.
boolean
"archived"
,
default:
false
,
null:
false
t
.
boolean
"archived"
,
default:
false
,
null:
false
t
.
string
"avatar"
t
.
string
"import_status"
t
.
string
"import_status"
t
.
float
"repository_size"
,
default:
0.0
t
.
float
"repository_size"
,
default:
0.0
t
.
integer
"star_count"
,
default:
0
,
null:
false
t
.
integer
"star_count"
,
default:
0
,
null:
false
t
.
string
"import_type"
t
.
string
"import_type"
t
.
string
"import_source"
t
.
string
"import_source"
t
.
string
"avatar"
end
end
add_index
"projects"
,
[
"created_at"
,
"id"
],
name:
"index_projects_on_created_at_and_id"
,
using: :btree
add_index
"projects"
,
[
"created_at"
,
"id"
],
name:
"index_projects_on_created_at_and_id"
,
using: :btree
...
...
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