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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
03370b01
Commit
03370b01
authored
Jan 29, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ES: writing index status
parent
a383f6ec
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
1 deletion
+38
-1
app/models/index_status.rb
app/models/index_status.rb
+3
-0
app/models/project.rb
app/models/project.rb
+1
-0
db/migrate/20160129075828_create_index_statuses.rb
db/migrate/20160129075828_create_index_statuses.rb
+14
-0
db/schema.rb
db/schema.rb
+13
-1
lib/tasks/gitlab/elastic.rake
lib/tasks/gitlab/elastic.rake
+7
-0
No files found.
app/models/index_status.rb
0 → 100644
View file @
03370b01
class
IndexStatus
<
ActiveRecord
::
Base
belongs_to
:project
end
app/models/project.rb
View file @
03370b01
...
...
@@ -128,6 +128,7 @@ class Project < ActiveRecord::Base
has_one
:custom_issue_tracker_service
,
dependent: :destroy
has_one
:gitlab_issue_tracker_service
,
dependent: :destroy
has_one
:external_wiki_service
,
dependent: :destroy
has_one
:index_status
,
dependent: :destroy
has_one
:forked_project_link
,
dependent: :destroy
,
foreign_key:
"forked_to_project_id"
has_one
:forked_from_project
,
through: :forked_project_link
...
...
db/migrate/20160129075828_create_index_statuses.rb
0 → 100644
View file @
03370b01
class
CreateIndexStatuses
<
ActiveRecord
::
Migration
def
change
create_table
:index_statuses
do
|
t
|
t
.
integer
:project_id
t
.
datetime
:indexed_at
t
.
text
:note
t
.
string
:last_commit
t
.
timestamps
null:
false
end
add_index
:index_statuses
,
:project_id
end
end
db/schema.rb
View file @
03370b01
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2016012
0172143
)
do
ActiveRecord
::
Schema
.
define
(
version:
2016012
9075828
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -414,6 +414,7 @@ ActiveRecord::Schema.define(version: 20160120172143) do
add_index
"geo_nodes"
,
[
"host"
],
name:
"index_geo_nodes_on_host"
,
using: :btree
add_index
"geo_nodes"
,
[
"primary"
],
name:
"index_geo_nodes_on_primary"
,
using: :btree
create_table
"git_hooks"
,
force: :cascade
do
|
t
|
t
.
string
"force_push_regex"
t
.
string
"delete_branch_regex"
...
...
@@ -447,6 +448,17 @@ ActiveRecord::Schema.define(version: 20160120172143) do
add_index
"identities"
,
[
"created_at"
,
"id"
],
name:
"index_identities_on_created_at_and_id"
,
using: :btree
add_index
"identities"
,
[
"user_id"
],
name:
"index_identities_on_user_id"
,
using: :btree
create_table
"index_statuses"
,
force: :cascade
do
|
t
|
t
.
integer
"project_id"
t
.
datetime
"indexed_at"
t
.
text
"note"
t
.
string
"last_commit"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
end
add_index
"index_statuses"
,
[
"project_id"
],
name:
"index_index_statuses_on_project_id"
,
using: :btree
create_table
"issues"
,
force: :cascade
do
|
t
|
t
.
string
"title"
t
.
integer
"assignee_id"
...
...
lib/tasks/gitlab/elastic.rake
View file @
03370b01
...
...
@@ -19,8 +19,15 @@ namespace :gitlab do
puts
"Indexing
#{
project
.
name_with_namespace
}
..."
begin
# During indexing the new commits can be pushed,
# this parameter only indicates that at least this commit is in index
heeads_sha
=
project
.
repository
.
commit
.
sha
IndexStatus
.
find_or_create_by
(
last_commit:
heeads_sha
,
project:
project
)
project
.
repository
.
index_commits
project
.
repository
.
index_blobs
project
.
index_status
.
update
(
indexed_at:
DateTime
.
now
)
puts
"Done!"
.
green
rescue
StandardError
=>
e
puts
"
#{
e
.
message
}
, trace -
#{
e
.
backtrace
}
"
...
...
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