已repository_id为范围,version唯一性控制
This commit is contained in:
parent
2381a78e1b
commit
537cc20e06
|
@ -1,5 +1,8 @@
|
|||
class Commit < ActiveRecord::Base
|
||||
attr_accessible :comments, :committed_on, :committer, :project_id, :repository_id, :version
|
||||
validates :repository_id, presence: true
|
||||
validates :version, presence: true, uniqueness: {scope: :repository_id}
|
||||
validates :committed_on, presence: true
|
||||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
after_create :act_as_forge_activity
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ namespace :gitlab do
|
|||
ids = [2,847,931,942]
|
||||
projects = Project.find(ids)
|
||||
projects.each do |project|
|
||||
c = Commit.where(:project_id => project.id)
|
||||
if c.blank?
|
||||
# c = Commit.where(:project_id => project.id)
|
||||
# if c.blank?
|
||||
begin
|
||||
g_project = g.project(project.gpid)
|
||||
# 获取默认分支
|
||||
|
@ -26,7 +26,7 @@ namespace :gitlab do
|
|||
rescue Exception => e
|
||||
puts e
|
||||
end
|
||||
end
|
||||
# end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue