package migrations

import (
	issues_model "code.gitea.io/gitea/models/issues"
	repo_model "code.gitea.io/gitea/models/repo"
	"code.gitea.io/gitea/modules/timeutil"
	"xorm.io/xorm"
)

func createPullRequestDiffTable(x *xorm.Engine) error {
	type PullRequestVersion struct {
		ID            int64                     `xorm:"pk autoincr"`
		RepoID        int64                     `xorm:"INDEX"`
		Repo          *repo_model.Repository    `xorm:"-"`
		PullID        int64                     `xorm:"INDEX"`
		Pull          *issues_model.PullRequest `xorm:"-"`
		AddLineNum    int
		CommitsCount  int
		DelLineNum    int
		FilesCount    int
		HeadCommitID  string             `xorm:"VARCHAR(40)"`
		BaseCommitID  string             `xorm:"VARCHAR(40)"`
		StartCommitID string             `xorm:"VARCHAR(40)"`
		CreatedUnix   timeutil.TimeStamp `xorm:"created INDEX"`
		UpdatedUnix   timeutil.TimeStamp `xorm:"updated INDEX"`
	}

	return x.Sync2(new(PullRequestVersion))
}
