making progress

This commit is contained in:
2026-05-07 02:06:54 +02:00
parent 7b7e2d399c
commit dea186c995
39 changed files with 2021 additions and 67 deletions
+22
View File
@@ -0,0 +1,22 @@
package models
import "time"
type IssueState string
const (
IssueStateOpen IssueState = "open"
IssueStateClosed IssueState = "closed"
)
type Issue struct {
ID int64 `xorm:"'id' pk autoincr" json:"id"`
RepoID int64 `xorm:"'repo_id' notnull index" json:"repoId"`
AuthorID int64 `xorm:"'author_id' notnull index" json:"authorId"`
Number int `xorm:"'number' notnull" json:"number"`
Title string `xorm:"'title' notnull varchar(255)" json:"title"`
Body string `xorm:"'body' text" json:"body"`
State IssueState `xorm:"'state' default 'open' varchar(16)" json:"state"`
CreatedAt time.Time `xorm:"'created_at' created" json:"createdAt"`
UpdatedAt time.Time `xorm:"'updated_at' updated" json:"updatedAt"`
}
+7 -2
View File
@@ -6,10 +6,15 @@ import (
)
func Run(engine *xorm.Engine) error {
return engine.Sync2(
if err := engine.Sync2(
&models.User{},
&models.Repository{},
&models.PullRequest{},
&models.FederationActor{},
)
&models.Issue{},
&models.SSHKey{},
); err != nil {
return err
}
return Run002(engine)
}
@@ -0,0 +1,13 @@
package migrations
import (
"github.com/forgeo/forgebucket/internal/models"
"xorm.io/xorm"
)
func Run002(engine *xorm.Engine) error {
return engine.Sync2(
&models.Issue{},
&models.SSHKey{},
)
}
+12
View File
@@ -0,0 +1,12 @@
package models
import "time"
type SSHKey struct {
ID int64 `xorm:"'id' pk autoincr" json:"id"`
UserID int64 `xorm:"'user_id' notnull index" json:"userId"`
Title string `xorm:"'title' notnull varchar(255)" json:"title"`
Fingerprint string `xorm:"'fingerprint' notnull unique" json:"fingerprint"`
PublicKey string `xorm:"'public_key' text notnull" json:"publicKey"`
CreatedAt time.Time `xorm:"'created_at' created" json:"createdAt"`
}