BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
14 deletions
+21
-14
base_controller.rb
app/controllers/import/base_controller.rb
+8
-10
20150306023112_add_unique_index_to_namespace.rb
db/migrate/20150306023112_add_unique_index_to_namespace.rb
+9
-0
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
private
def
get_or_create_namespace
existing_namespace
=
Namespace
.
find_by_path_or_name
(
@target_namespace
)
if
existing_namespace
if
existing_namespace
.
owner
==
current_user
namespace
=
existing_namespace
else
begin
namespace
=
Group
.
create!
(
name:
@target_namespace
,
path:
@target_namespace
,
owner:
current_user
)
namespace
.
add_owner
(
current_user
)
rescue
ActiveRecord
::
RecordNotUnique
,
ActiveRecord
::
RecordInvalid
namespace
=
Namespace
.
find_by_path_or_name
(
@target_namespace
)
unless
namespace
.
owner
==
current_user
@already_been_taken
=
true
return
false
end
else
namespace
=
Group
.
create
(
name:
@target_namespace
,
path:
@target_namespace
,
owner:
current_user
)
namespace
.
add_owner
(
current_user
)
namespace
end
namespace
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 @@
#
# 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
enable_extension
"plpgsql"
...
...
@@ -242,9 +242,9 @@ ActiveRecord::Schema.define(version: 20150225065047) do
end
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"
,
[
"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
create_table
"notes"
,
force:
true
do
|
t
|
...
...
@@ -334,12 +334,12 @@ ActiveRecord::Schema.define(version: 20150225065047) do
t
.
string
"import_url"
t
.
integer
"visibility_level"
,
default:
0
,
null:
false
t
.
boolean
"archived"
,
default:
false
,
null:
false
t
.
string
"avatar"
t
.
string
"import_status"
t
.
float
"repository_size"
,
default:
0.0
t
.
integer
"star_count"
,
default:
0
,
null:
false
t
.
string
"import_type"
t
.
string
"import_source"
t
.
string
"avatar"
end
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