diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-06-08 18:39:32 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2017-06-27 15:59:50 +0200 |
commit | 2bda45ebba948d28a70456ec00e9fe3fe882b8a0 (patch) | |
tree | 57f26980dac71717bacf9d1adb72ce4275dcb710 /app | |
parent | 4503240abdd9a38e801aef49edad9ff9c7f9457d (diff) | |
download | gitlab-ce-split-events-into-push-events.tar.gz |
Use a separate table for storing push eventssplit-events-into-push-events
Diffstat (limited to 'app')
-rw-r--r-- | app/models/concerns/sha_attribute.rb | 9 | ||||
-rw-r--r-- | app/models/push_event.rb | 20 |
2 files changed, 29 insertions, 0 deletions
diff --git a/app/models/concerns/sha_attribute.rb b/app/models/concerns/sha_attribute.rb new file mode 100644 index 00000000000..3935b9fee9f --- /dev/null +++ b/app/models/concerns/sha_attribute.rb @@ -0,0 +1,9 @@ +module ShaAttribute + extend ActiveSupport::Concern + + module ClassMethods + def sha_attribute(name) + attribute(name, Gitlab::Database::ShaAttribute.new) + end + end +end diff --git a/app/models/push_event.rb b/app/models/push_event.rb new file mode 100644 index 00000000000..29fbafe934d --- /dev/null +++ b/app/models/push_event.rb @@ -0,0 +1,20 @@ +class PushEvent < ActiveRecord::Base + include ShaAttribute + + belongs_to :project + belongs_to :user + + sha_attribute :first_commit + sha_attribute :last_commit + + enum action: { + created: 0, + removed: 1, + pushed: 2 + } + + enum ref_type: { + branch: 0, + tag: 1 + } +end |