Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Save vcsType as part of push event

天舟40268f41c16f
diff --git a/backend/api/vcs.go b/backend/api/vcs.go
index 2151c821fc..3f7f7ff63b 100644
--- a/backend/api/vcs.go
+++ b/backend/api/vcs.go
@@ -111,6 +111,7 @@ type VCSFileCommit struct {
}
type VCSPushEvent struct {
+ VCSType VCSType `json:"vcsType"`
Ref string `json:"ref"`
RepositoryID string `json:"repoId"`
RepositoryURL string `json:"repoUrl"`
diff --git a/backend/server/webhook.go b/backend/server/webhook.go
index 663e4a1c21..03f186fd35 100644
--- a/backend/server/webhook.go
+++ b/backend/server/webhook.go
@@ -121,6 +121,7 @@ func (s *Server) registerWebhookRoutes(g *echo.Group) {
s.l.Warn("Failed to parse timestamp. Ignored", zap.String("filename", filename), zap.Error(err))
}
vcsPushEvent := api.VCSPushEvent{
+ VCSType: repository.VCS.Type,
Ref: pushEvent.Ref,
RepositoryID: strconv.Itoa(pushEvent.Project.ID),
RepositoryURL: pushEvent.Project.WebURL,
diff --git a/backend/store/seed/0110_task.sql b/backend/store/seed/0110_task.sql
index 3c4b3cf11c..34847ed95a 100644
--- a/backend/store/seed/0110_task.sql
+++ b/backend/store/seed/0110_task.sql
@@ -237,5 +237,5 @@ VALUES
'create todo table',
'bb.task.database.schema.update',
'PENDING',
- '{"statement":"CREATE TABLE todo (\n id INTEGER PRIMARY KEY AUTO_INCREMENT,\n title TEXT\n)\n","pushEvent":{"ref":"refs/heads/master","repoId":"7","repoUrl":"http://gitlab.bytebase.com/bytebase-test/project1","repoFullPath":"bytebase-test/project1","authorName":"tianzhou","fileCommit":{"id":"e3b3f33a455a7e3cd999b44fa9cb8ddb633e1d29","title":"Create todo table to staging db1","message":"Create todo table to staging db1","createdTs":1624006500,"url":"http://gitlab.bytebase.com/bytebase-test/project1/-/commit/e3b3f33a455a7e3cd999b44fa9cb8ddb633e1d29","authorName":"tianzhou","added":"bytebase/20210618164921_stagingdb1_create_todo_table.sql"}}}'
+ '{"statement":"CREATE TABLE todo (\n id INTEGER PRIMARY KEY AUTO_INCREMENT,\n title TEXT\n)\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","ref":"refs/heads/master","repoId":"7","repoUrl":"http://gitlab.bytebase.com/bytebase-test/project1","repoFullPath":"bytebase-test/project1","authorName":"tianzhou","fileCommit":{"id":"e3b3f33a455a7e3cd999b44fa9cb8ddb633e1d29","title":"Create todo table to staging db1","message":"Create todo table to staging db1","createdTs":1624006500,"url":"http://gitlab.bytebase.com/bytebase-test/project1/-/commit/e3b3f33a455a7e3cd999b44fa9cb8ddb633e1d29","authorName":"tianzhou","added":"bytebase/20210618164921_stagingdb1_create_todo_table.sql"}}}'
);
\ No newline at end of file