Hi,
I was looking to a nice feature I could implement, e.g. ssh deploy keys, and I notice I will have to make db changes that are more than simply adding tables and columns.
How does xorm handle index updates and column removals? Is there any way to insert migration code?
type PublicKey struct {
Id int64
OwnerId int64 `xorm:"UNIQUE(s) INDEX NOT NULL"`
Name string `xorm:"UNIQUE(s) NOT NULL"`
Fingerprint string `xorm:"INDEX NOT NULL"`
Content string `xorm:"TEXT NOT NULL"`
Created time.Time `xorm:"CREATED"`
Updated time.Time
HasRecentActivity bool `xorm:"-"`
HasUsed bool `xorm:"-"`
}
Lets say we want to remove the OwnerId from this struct and add these two structs
// One to many relationship
type PublicKeyOwner struct {
Id int64
OwnerId int64 `xorm:"INDEX NOT NULL"`
PublicKeyId int64 `xorm:"UNIQUE INDEX NOT NULL"`
}
// Many-to-many relationship
type PublicKeyRepo struct {
Id int64
RepoId int64 `xorm:"UNIQUE(s) INDEX NOT NULL"`
PublicKeyId int64 `xorm:"UNIQUE(s) INDEX NOT NULL"`
}
Just coding this will work great for new Gogs installations, but how will migration be done?
Regards,
Peter