summaryrefslogtreecommitdiffstats
path: root/models/issue_watch.go
diff options
context:
space:
mode:
authorAndrey Nering <andrey.nering@gmail.com>2017-03-19 16:54:12 -0300
committerAndrey Nering <andrey.nering@gmail.com>2017-03-29 19:55:40 -0300
commita0d0de7233cd8a85d6572ae13d74078482a1ee27 (patch)
tree6904155c14910705cd4a882a4947dc2254c9da10 /models/issue_watch.go
parent129b0d6a4b408555c579e7ccb2fb15d3d8fcef29 (diff)
downloadgitea-a0d0de7233cd8a85d6572ae13d74078482a1ee27.tar.gz
gitea-a0d0de7233cd8a85d6572ae13d74078482a1ee27.zip
Create issue_watch table
Diffstat (limited to 'models/issue_watch.go')
-rw-r--r--models/issue_watch.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/models/issue_watch.go b/models/issue_watch.go
new file mode 100644
index 0000000000..96e080136f
--- /dev/null
+++ b/models/issue_watch.go
@@ -0,0 +1,20 @@
+package models
+
+import (
+ "time"
+)
+
+// IssueWatch is connection request for receiving issue notification.
+type IssueWatch struct {
+ ID int64 `xorm:"pk autoincr"`
+ UserID int64 `xorm:"UNIQUE(watch) NOT NULL"`
+ IssueID int64 `xorm:"UNIQUE(watch) NOT NULL"`
+ IsWatching bool `xorm:"NOT NULL"`
+ Created time.Time `xorm:"-"`
+ CreatedUnix int64 `xorm:"NOT NULL"`
+}
+
+// BeforeInsert is invoked from XORM before inserting an object of this type.
+func (iw *IssueWatch) BeforeInsert() {
+ iw.CreatedUnix = time.Now().Unix()
+}