gitlink-forgeplus/app/models/mirror.rb

14 lines
343 B
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

class Mirror < ApplicationRecord
# 0 - succeeded, 1 - waiting, 2 - failed
# 0: 同步镜像成功1: 正在同步镜像2: 同步失败默认值为0
enum status: { succeeded: 0, waiting: 1, failed: 2 }
belongs_to :repository
def set_status!(status=Mirror.statuses[:succeeded])
update_column(status: status)
end
end