enhance(migrate):增加基于bun的迁移脚本。

This commit is contained in:
徐涛
2022-09-15 13:48:46 +08:00
parent 4254d020b9
commit 9380879ab5
8 changed files with 391 additions and 11 deletions

View File

@@ -3,30 +3,30 @@ package model
import "time"
type Created struct {
CreatedAt time.Time `xorm:"timestampz not null created" json:"createdAt" time_format:"simple_datetime" time_location:"shanghai"`
CreatedAt time.Time `bun:"type:timestamptz,notnull,default:current_timestamp" json:"createdAt" time_format:"simple_datetime" time_location:"shanghai"`
}
type CreatedWithUser struct {
Created `xorm:"extends"`
CreatedBy *string `xorm:"varchar(100)" json:"createdBy"`
Created `bun:",extend"`
CreatedBy *string `json:"createdBy"`
}
type Deleted struct {
DeletedAt *time.Time `xorm:"timestampz deleted" json:"deletedAt" time_format:"simple_datetime" time_location:"shanghai"`
DeletedAt *time.Time `bun:"type:timestamptz,soft_delete,nullzero" json:"deletedAt" time_format:"simple_datetime" time_location:"shanghai"`
}
type DeletedWithUser struct {
Deleted `xorm:"extends"`
DeletedBy *string `xorm:"varchar(120)" json:"deletedBy"`
Deleted `bun:",extend"`
DeletedBy *string `json:"deletedBy"`
}
type CreatedAndModified struct {
Created `xorm:"extends"`
LastModifiedAt *time.Time `xorm:"timestampz updated" json:"lastModifiedAt" time_format:"simple_datetime" time_location:"shanghai"`
Created `bun:",extend"`
LastModifiedAt *time.Time `bun:"type:timestamptz,nullzero,default:current_timestamp" json:"lastModifiedAt" time_format:"simple_datetime" time_location:"shanghai"`
}
type CreatedAndModifiedWithUser struct {
CreatedAndModified `xorm:"extends"`
CreatedBy *string `xorm:"varchar(100)" json:"createdBy"`
LastModifiedBy *string `xorm:"varchar(100)" json:"lastModifiedBy"`
CreatedAndModified `bun:",extend"`
CreatedBy *string `json:"createdBy"`
LastModifiedBy *string `json:"lastModifiedBy"`
}