文件上传数据库
This commit is contained in:
@@ -12,6 +12,19 @@ import (
|
||||
var DB *gorm.DB
|
||||
var err error
|
||||
|
||||
type File_info struct {
|
||||
ID uint `gorm:"primaryKey;autoIncrement"`
|
||||
Name string `gorm:"not null;size:256;index"` // 前端报告的文件名
|
||||
Path string `gorm:"not null;size:300"` //
|
||||
Sha256 string `gorm:"not null;size:256;index"` //
|
||||
Mime string `gorm:"size:64;index"`
|
||||
Type string `gorm:"size:64;index"`
|
||||
Const uint `gorm:"default:1;index"`
|
||||
Per uint `gorm:"default:1"`
|
||||
UserID uint `gorm:"not null;index"`
|
||||
Date time.Time `gorm:"type:datetime;default:CURRENT_TIMESTAMP"` // 默认当前时间
|
||||
}
|
||||
|
||||
type User struct {
|
||||
ID uint `gorm:"primaryKey;autoIncrement"` // 自增主键
|
||||
Name string `gorm:"size:100;uniqueIndex"` // 唯一约束索引
|
||||
@@ -188,4 +201,6 @@ func Init_database() {
|
||||
|
||||
DB.AutoMigrate(&Ticket{})
|
||||
|
||||
DB.AutoMigrate(&File_info{})
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user