photoprism/internal/entity/event.go
Michael Mayer 01ca94d536 Backend: Initialize test db with fixtures #84 #129
Fixtures can be found in assets/resources/examples/fixtures.sql and must be maintained manually for now

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-01-06 02:14:17 +01:00

33 lines
816 B
Go

package entity
import (
"time"
"github.com/jinzhu/gorm"
)
// Events
type Event struct {
EventUUID string `gorm:"type:varbinary(36);unique_index;"`
EventSlug string `gorm:"type:varbinary(128);unique_index;"`
EventName string
EventType string
EventDescription string `gorm:"type:text;"`
EventNotes string `gorm:"type:text;"`
EventBegin time.Time `gorm:"type:datetime;"`
EventEnd time.Time `gorm:"type:datetime;"`
EventLat float64
EventLng float64
EventDist float64
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt *time.Time `sql:"index"`
}
func (Event) TableName() string {
return "events"
}
func (e *Event) BeforeCreate(scope *gorm.Scope) error {
return scope.SetColumn("EventUUID", ID('e'))
}