summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/concerns/sha_attribute.rb9
-rw-r--r--app/models/push_event.rb20
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