Commit 3dff8b82 authored by Valery Sizov's avatar Valery Sizov

ES: update schema

parent eabad632
class IndexStatus < ActiveRecord::Base
belongs_to :project
validates :project_id, uniqueness: true, presense: true
validates :project_id, uniqueness: true, presence: true
end
......@@ -449,7 +449,7 @@ ActiveRecord::Schema.define(version: 20160129075828) do
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.integer "project_id", null: false
t.datetime "indexed_at"
t.text "note"
t.string "last_commit"
......@@ -457,7 +457,7 @@ ActiveRecord::Schema.define(version: 20160129075828) do
t.datetime "updated_at", null: false
end
add_index "index_statuses", ["project_id"], name: "index_index_statuses_on_project_id", using: :btree
add_index "index_statuses", ["project_id"], name: "index_index_statuses_on_project_id", unique: true, using: :btree
create_table "issues", force: :cascade do |t|
t.string "title"
......
......@@ -11,9 +11,9 @@ namespace :gitlab do
puts "Indexing #{project.name_with_namespace} (ID=#{project.id})..."
index_status = IndexStatus.find_or_create_by(project: project)
heads_sha = project.repository.commit.sha
head_sha = project.repository.commit.sha
if index_status.last_commit == heads_sha
if index_status.last_commit == head_sha
puts "Skipped".yellow
next
end
......@@ -24,7 +24,7 @@ namespace :gitlab do
# During indexing the new commits can be pushed,
# the last_commit parameter only indicates that at least this commit is in index
index_status.update(last_commit: heads_sha, indexed_at: DateTime.now)
index_status.update(last_commit: head_sha, indexed_at: DateTime.now)
puts "Done!".green
rescue StandardError => e
puts "#{e.message}, trace - #{e.backtrace}"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment