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
872bbb9f
Commit
872bbb9f
authored
Apr 13, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup required migrations
parent
daa29729
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
10 deletions
+7
-10
db/migrate/20160331204039_add_action_to_ci_commit.rb
db/migrate/20160331204039_add_action_to_ci_commit.rb
+0
-5
db/migrate/20160411122626_add_duration_to_ci_commit.rb
db/migrate/20160411122626_add_duration_to_ci_commit.rb
+0
-5
db/migrate/20160412173416_add_fields_to_ci_commit.rb
db/migrate/20160412173416_add_fields_to_ci_commit.rb
+1
-0
db/migrate/20160412173417_update_ci_commit.rb
db/migrate/20160412173417_update_ci_commit.rb
+4
-0
db/migrate/20160412173418_add_ci_commit_indexes.rb
db/migrate/20160412173418_add_ci_commit_indexes.rb
+2
-0
No files found.
db/migrate/20160331204039_add_action_to_ci_commit.rb
deleted
100644 → 0
View file @
daa29729
class
AddActionToCiCommit
<
ActiveRecord
::
Migration
def
change
add_column
:ci_commits
,
:action
,
:string
end
end
db/migrate/20160411122626_add_duration_to_ci_commit.rb
deleted
100644 → 0
View file @
daa29729
class
AddDurationToCiCommit
<
ActiveRecord
::
Migration
def
change
add_column
:ci_commits
,
:duration
,
:integer
end
end
db/migrate/20160
331153918
_add_fields_to_ci_commit.rb
→
db/migrate/20160
412173416
_add_fields_to_ci_commit.rb
View file @
872bbb9f
...
@@ -3,5 +3,6 @@ class AddFieldsToCiCommit < ActiveRecord::Migration
...
@@ -3,5 +3,6 @@ class AddFieldsToCiCommit < ActiveRecord::Migration
add_column
:ci_commits
,
:status
,
:string
add_column
:ci_commits
,
:status
,
:string
add_column
:ci_commits
,
:started_at
,
:timestamp
add_column
:ci_commits
,
:started_at
,
:timestamp
add_column
:ci_commits
,
:finished_at
,
:timestamp
add_column
:ci_commits
,
:finished_at
,
:timestamp
add_column
:ci_commits
,
:duration
,
:integer
end
end
end
end
db/migrate/2016041217
5
417_update_ci_commit.rb
→
db/migrate/2016041217
3
417_update_ci_commit.rb
View file @
872bbb9f
class
UpdateCiCommit
<
ActiveRecord
::
Migration
class
UpdateCiCommit
<
ActiveRecord
::
Migration
# This migration can be run online, but needs to be executed for the second time after restarting Unicorn workers
# Otherwise Offline migration should be used.
def
change
def
change
execute
(
"UPDATE ci_commits SET status=
#{
status
}
, ref=
#{
ref
}
, tag=
#{
tag
}
WHERE status IS NULL"
)
execute
(
"UPDATE ci_commits SET status=
#{
status
}
, ref=
#{
ref
}
, tag=
#{
tag
}
WHERE status IS NULL"
)
end
end
private
def
status
def
status
builds
=
'(SELECT COUNT(*) FROM ci_builds WHERE ci_builds.commit_id=ci_commits.id)'
builds
=
'(SELECT COUNT(*) FROM ci_builds WHERE ci_builds.commit_id=ci_commits.id)'
success
=
"(SELECT COUNT(*) FROM ci_builds WHERE ci_builds.commit_id=ci_commits.id AND status='success')"
success
=
"(SELECT COUNT(*) FROM ci_builds WHERE ci_builds.commit_id=ci_commits.id AND status='success')"
...
...
db/migrate/2016041217
4954
_add_ci_commit_indexes.rb
→
db/migrate/2016041217
3418
_add_ci_commit_indexes.rb
View file @
872bbb9f
...
@@ -7,6 +7,8 @@ class AddCiCommitIndexes < ActiveRecord::Migration
...
@@ -7,6 +7,8 @@ class AddCiCommitIndexes < ActiveRecord::Migration
add_index
:ci_commits
,
[
:status
],
index_options
add_index
:ci_commits
,
[
:status
],
index_options
end
end
private
def
index_options
def
index_options
{
algorithm: :concurrently
}
if
Gitlab
::
Database
.
postgresql?
{
algorithm: :concurrently
}
if
Gitlab
::
Database
.
postgresql?
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