fix: sqlite error

This commit is contained in:
henry.chen
2021-07-25 10:45:33 +08:00
parent cdbe082764
commit e2046d0d39
5 changed files with 16 additions and 15 deletions

1
.gitignore vendored
View File

@@ -6,6 +6,7 @@
*.dylib *.dylib
*.DS_Store *.DS_Store
*.tar.gz *.tar.gz
*.db
backend backend
# Test binary, built with `go test -c` # Test binary, built with `go test -c`

View File

@@ -1,7 +1,7 @@
appname: eiblog appname: eiblog
database: database:
driver: postgres driver: sqlite
source: host=localhost port=5432 user=postgres dbname=eiblog sslmode=disable password=MTI3LjAuMC4x source: ./eiblog.db
eshost: eshost:
eiblogapp: eiblogapp:
mode: mode:

View File

@@ -13,9 +13,9 @@ type Account struct {
PhoneN string `gorm:"column:phone_n;not null" bson:"phone_n"` // 手机号 PhoneN string `gorm:"column:phone_n;not null" bson:"phone_n"` // 手机号
Address string `gorm:"column:address;not null" bson:"address"` // 地址信息 Address string `gorm:"column:address;not null" bson:"address"` // 地址信息
LogoutAt time.Time `gorm:"column:logout_at;not null" bson:"logout_at"` // 登出时间 LogoutAt time.Time `gorm:"column:logout_at;not null" bson:"logout_at"` // 登出时间
LoginIP string `gorm:"column:login_ip;not null" bson:"login_ip"` // 最近登录IP LoginIP string `gorm:"column:login_ip;not null" bson:"login_ip"` // 最近登录IP
LoginUA string `gorm:"column:login_ua;not null" bson:"login_ua"` // 最近登录IP LoginUA string `gorm:"column:login_ua;not null" bson:"login_ua"` // 最近登录IP
LoginAt time.Time `gorm:"column:login_at;default:now()" bson:"login_at"` // 最近登录时间 LoginAt time.Time `gorm:"column:login_at;default:current_timestamp" bson:"login_at"` // 最近登录时间
CreatedAt time.Time `gorm:"column:created_at;default:now()" bson:"created_at"` // 创建时间 CreatedAt time.Time `gorm:"column:created_at;default:current_timestamp" bson:"created_at"` // 创建时间
} }

View File

@@ -21,9 +21,9 @@ type Article struct {
Tags pq.StringArray `gorm:"column:tags;type:text[]" bson:"tags"` // tags Tags pq.StringArray `gorm:"column:tags;type:text[]" bson:"tags"` // tags
IsDraft bool `gorm:"column:is_draft;not null" bson:"is_draft"` // 是否是草稿 IsDraft bool `gorm:"column:is_draft;not null" bson:"is_draft"` // 是否是草稿
DeletedAt time.Time `gorm:"column:deleted_at;not null" bson:"deleted_at"` // 删除时间 DeletedAt time.Time `gorm:"column:deleted_at;not null" bson:"deleted_at"` // 删除时间
UpdatedAt time.Time `gorm:"column:updated_at;default:now()" bson:"updated_at"` // 更新时间 UpdatedAt time.Time `gorm:"column:updated_at;default:current_timestamp" bson:"updated_at"` // 更新时间
CreatedAt time.Time `gorm:"column:created_at;default:now()" bson:"created_at"` // 创建时间 CreatedAt time.Time `gorm:"column:created_at;default:current_timestamp" bson:"created_at"` // 创建时间
Header string `gorm:"-" bson:"-"` // header Header string `gorm:"-" bson:"-"` // header
Excerpt string `gorm:"-" bson:"-"` // 预览信息 Excerpt string `gorm:"-" bson:"-"` // 预览信息

View File

@@ -5,11 +5,11 @@ import "time"
// Serie 专题 // Serie 专题
type Serie struct { type Serie struct {
ID int `gorm:"column:id;primaryKey" bson:"id"` // 自增ID ID int `gorm:"column:id;primaryKey" bson:"id"` // 自增ID
Slug string `gorm:"column:slug;not null;uniqueIndex" bson:"slug"` // 缩略名 Slug string `gorm:"column:slug;not null;uniqueIndex" bson:"slug"` // 缩略名
Name string `gorm:"column:name;not null" bson:"name"` // 专题名 Name string `gorm:"column:name;not null" bson:"name"` // 专题名
Desc string `gorm:"column:desc;not null" bson:"desc"` // 专题描述 Desc string `gorm:"column:desc;not null" bson:"desc"` // 专题描述
CreatedAt time.Time `gorm:"column:created_at;default:now()" bson:"created_at"` // 创建时间 CreatedAt time.Time `gorm:"column:created_at;default:current_timestamp" bson:"created_at"` // 创建时间
Articles SortedArticles `gorm:"-" bson:"-"` // 专题下的文章 Articles SortedArticles `gorm:"-" bson:"-"` // 专题下的文章
} }