2024-08-27 19:03:07 +08:00
|
|
|
|
package devstar_devcontainer
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
"code.gitea.io/gitea/models/db"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2024-08-29 12:53:07 +08:00
|
|
|
|
// DevstarDevcontainer devContainer 关联 代码仓库 和 用户
|
2024-08-27 19:03:07 +08:00
|
|
|
|
//
|
2024-09-30 06:48:01 +00:00
|
|
|
|
// TODO 移除 port 信息,需要前端主动连接时候实时获取最新分配结果,可以考虑给用户API提供选项:是否阻塞等待
|
|
|
|
|
|
//
|
|
|
|
|
|
// 遵循gonic规则映射数据库表 `devstar_devcontainer`,各字段注解见 https://xorm.io/docs/chapter-02/4.columns/
|
2024-08-27 19:03:07 +08:00
|
|
|
|
type DevstarDevcontainer struct {
|
2024-08-28 15:36:22 +08:00
|
|
|
|
Id int64 `xorm:"BIGINT pk NOT NULL autoincr 'id' comment('主键,devContainerId')"`
|
2024-08-30 12:28:59 +00:00
|
|
|
|
Name string `xorm:"VARCHAR(64) charset=utf8mb4 collate=utf8mb4_bin UNIQUE NOT NULL 'name' comment('devContainer名称,自动生成')"`
|
|
|
|
|
|
DevcontainerHost string `xorm:"VARCHAR(256) charset=utf8mb4 collate=utf8mb4_bin NOT NULL 'devcontainer_host' comment('SSH Host')"`
|
2024-08-28 15:36:22 +08:00
|
|
|
|
DevcontainerPort uint16 `xorm:"SMALLINT UNSIGNED NOT NULL 'devcontainer_port' comment('SSH Port')"`
|
|
|
|
|
|
DevcontainerUsername string `xorm:"VARCHAR(32) charset=utf8mb4 collate=utf8mb4_bin NOT NULL 'devcontainer_username' comment('SSH Username')"`
|
|
|
|
|
|
DevcontainerWorkDir string `xorm:"VARCHAR(256) charset=utf8mb4 collate=utf8mb4_bin NOT NULL 'devcontainer_work_dir' comment('SSH 工作路径,典型值 ~/${project_name},256字节以内')"`
|
2024-08-29 12:53:07 +08:00
|
|
|
|
RepoId int64 `xorm:"BIGINT NOT NULL 'repo_id' comment('repository表主键')"`
|
|
|
|
|
|
UserId int64 `xorm:"BIGINT NOT NULL 'user_id' comment('user表主键')"`
|
2024-10-23 03:05:44 +00:00
|
|
|
|
CreatedUnix int64 `xorm:"BIGINT 'created_unix' comment('创建时间戳')"`
|
|
|
|
|
|
UpdatedUnix int64 `xorm:"BIGINT 'updated_unix' comment('更新时间戳')"`
|
2024-08-27 19:03:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
|
db.RegisterModel(new(DevstarDevcontainer))
|
|
|
|
|
|
}
|