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
Jérome Perrin
gitlab-ce
Commits
18411645
Commit
18411645
authored
Mar 02, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add initial migrations
parent
cb6af816
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
0 deletions
+24
-0
app/models/project.rb
app/models/project.rb
+1
-0
db/migrate/20160302151724_add_import_credentials_to_projects.rb
...rate/20160302151724_add_import_credentials_to_projects.rb
+6
-0
db/migrate/20160302152808_remove_wrong_import_url_from_projects.rb
...e/20160302152808_remove_wrong_import_url_from_projects.rb
+17
-0
No files found.
app/models/project.rb
View file @
18411645
...
@@ -91,6 +91,7 @@ class Project < ActiveRecord::Base
...
@@ -91,6 +91,7 @@ class Project < ActiveRecord::Base
attr_accessor
:new_default_branch
attr_accessor
:new_default_branch
attr_accessor
:old_path_with_namespace
attr_accessor
:old_path_with_namespace
attr_encrypted
:import_credentials
,
key:
Gitlab
::
Application
.
secrets
.
db_key_base
# Relations
# Relations
belongs_to
:creator
,
foreign_key:
'creator_id'
,
class_name:
'User'
belongs_to
:creator
,
foreign_key:
'creator_id'
,
class_name:
'User'
...
...
db/migrate/20160302151724_add_import_credentials_to_projects.rb
0 → 100644
View file @
18411645
class
AddImportCredentialsToProjects
<
ActiveRecord
::
Migration
def
change
add_column
:projects
,
:encrypted_import_credentials
,
:text
add_column
:projects
,
:encrypted_import_credentials_iv
,
:text
end
end
db/migrate/20160302152808_remove_wrong_import_url_from_projects.rb
0 → 100644
View file @
18411645
class
RemoveWrongImportUrlFromProjects
<
ActiveRecord
::
Migration
def
up
projects_with_wrong_import_url
.
each
do
|
project
|
project
.
update_columns
(
import_url:
nil
)
# TODO Check really nil?
# TODO: migrate current credentials to import_credentials?
# TODO: Notify user ?
end
end
private
def
projects_with_dot_atom
# TODO Check live with #operations for possible false positives. Also, consider regex? But may have issues MySQL/PSQL
select_all
(
"SELECT p.id from projects p WHERE p.import_url LIKE '%//%:%@%' or p.import_url like '
#{
"_"
*
40
}
@github.com%'"
)
end
end
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