Skip to content

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

feat: rename vcs type and add BITBUCKET (#4876)

Tianzhou (天舟)165efc516e23
diff --git a/backend/legacyapi/principal.go b/backend/legacyapi/principal.go
index c02fcea59f..560968992a 100644
--- a/backend/legacyapi/principal.go
+++ b/backend/legacyapi/principal.go
@@ -34,10 +34,10 @@ type PrincipalAuthProvider string
const (
// PrincipalAuthProviderBytebase is the Bytebase's own authentication provider.
PrincipalAuthProviderBytebase PrincipalAuthProvider = "BYTEBASE"
- // PrincipalAuthProviderGitlabSelfHost is the self-hosted GitLab authentication provider.
- PrincipalAuthProviderGitlabSelfHost PrincipalAuthProvider = "GITLAB_SELF_HOST"
- // PrincipalAuthProviderGitHubCom is the GitHub.com authentication provider.
- PrincipalAuthProviderGitHubCom PrincipalAuthProvider = "GITHUB_COM"
+ // PrincipalAuthProviderGitlab is the GitLab (for both GitLab.com and self-hosted GitLab) authentication provider.
+ PrincipalAuthProviderGitlab PrincipalAuthProvider = "GITLAB"
+ // PrincipalAuthProviderGitHub is the GitHub (for both GitHub.com and GitHub Enterprise) authentication provider.
+ PrincipalAuthProviderGitHub PrincipalAuthProvider = "GITHUB"
)
// Principal is the API message for principals.
diff --git a/backend/legacyapi/sheet.go b/backend/legacyapi/sheet.go
index 9d9ad77de2..70794d0367 100644
--- a/backend/legacyapi/sheet.go
+++ b/backend/legacyapi/sheet.go
@@ -22,10 +22,10 @@ type SheetSource string
const (
// SheetFromBytebase is the sheet created by Bytebase. e.g. SQL Editor.
SheetFromBytebase SheetSource = "BYTEBASE"
- // SheetFromGitLabSelfHost is the sheet synced from self host GitLab.
- SheetFromGitLabSelfHost SheetSource = "GITLAB_SELF_HOST"
- // SheetFromGitHubCom is the sheet synced from github.com.
- SheetFromGitHubCom SheetSource = "GITHUB_COM"
+ // SheetFromGitLab is the sheet synced from GitLab (for both GitLab.com and self-hosted GitLab).
+ SheetFromGitLab SheetSource = "GITLAB"
+ // SheetFromGitHub is the sheet synced from GitHub (for both GitHub.com and GitHub Enterprise).
+ SheetFromGitHub SheetSource = "GITHUB"
)
// SheetType is the type of sheet.
@@ -37,7 +37,7 @@ const (
)
// SheetVCSPayload is the additional data payload of the VCS sheet.
-// The sheet source should be one of SheetFromGitLabSelfHost and SheetFromGitHubCom.
+// The sheet source should be one of SheetFromGitLab and SheetFromGitHub.
type SheetVCSPayload struct {
FileName string `json:"fileName"`
FilePath string `json:"filePath"`
diff --git a/backend/plugin/vcs/github/github.go b/backend/plugin/vcs/github/github.go
index e2a283a34f..8bbeb45ee5 100644
--- a/backend/plugin/vcs/github/github.go
+++ b/backend/plugin/vcs/github/github.go
@@ -36,7 +36,7 @@ const (
)
func init() {
- vcs.Register(vcs.GitHubCom, newProvider)
+ vcs.Register(vcs.GitHub, newProvider)
}
var _ vcs.Provider = (*Provider)(nil)
@@ -1352,7 +1352,7 @@ func (p WebhookPushEvent) ToVCS() vcs.PushEvent {
})
}
return vcs.PushEvent{
- VCSType: vcs.GitHubCom,
+ VCSType: vcs.GitHub,
Ref: p.Ref,
Before: p.Before,
After: p.After,
diff --git a/backend/plugin/vcs/gitlab/gitlab.go b/backend/plugin/vcs/gitlab/gitlab.go
index 1b8a7e72b6..7456125bdf 100644
--- a/backend/plugin/vcs/gitlab/gitlab.go
+++ b/backend/plugin/vcs/gitlab/gitlab.go
@@ -139,7 +139,7 @@ type gitLabRepository struct {
}
func init() {
- vcs.Register(vcs.GitLabSelfHost, newProvider)
+ vcs.Register(vcs.GitLab, newProvider)
}
// Provider is a GitLab self host VCS provider.
@@ -1303,7 +1303,7 @@ func (p WebhookPushEvent) ToVCS() (vcs.PushEvent, error) {
})
}
return vcs.PushEvent{
- VCSType: vcs.GitLabSelfHost,
+ VCSType: vcs.GitLab,
Ref: p.Ref,
Before: p.Before,
After: p.After,
diff --git a/backend/plugin/vcs/vcs.go b/backend/plugin/vcs/vcs.go
index ad7efa6c2c..b9a5cf644e 100644
--- a/backend/plugin/vcs/vcs.go
+++ b/backend/plugin/vcs/vcs.go
@@ -18,10 +18,10 @@ import (
type Type string
const (
- // GitLabSelfHost is the VCS type for GitLab self host.
- GitLabSelfHost Type = "GITLAB_SELF_HOST"
- // GitHubCom is the VCS type for GitHub.com.
- GitHubCom Type = "GITHUB_COM"
+ // GitLab is the VCS type for GitLab (both GitLab.com and self-hosted).
+ GitLab Type = "GITLAB"
+ // GitHub is the VCS type for GitHub (both GitHub.com and GitHun Enterprise).
+ GitHub Type = "GITHUB"
// SQLReviewAPISecretName is the api secret name used in GitHub action or GitLab CI workflow.
SQLReviewAPISecretName = "SQL_REVIEW_API_SECRET"
diff --git a/backend/server/auth.go b/backend/server/auth.go
index 452287203b..67124f42e5 100644
--- a/backend/server/auth.go
+++ b/backend/server/auth.go
@@ -80,7 +80,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusUnauthorized, "Incorrect password").SetInternal(err)
}
}
- case api.PrincipalAuthProviderGitlabSelfHost, api.PrincipalAuthProviderGitHubCom:
+ case api.PrincipalAuthProviderGitlab, api.PrincipalAuthProviderGitHub:
{
login := &api.VCSLogin{}
if err := jsonapi.UnmarshalPayload(c.Request().Body, login); err != nil {
@@ -140,7 +140,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
if user == nil {
if userInfo.PublicEmail == "" {
profileLink := "https://docs.github.com/en/account-and-profile"
- if authProvider == api.PrincipalAuthProviderGitlabSelfHost {
+ if authProvider == api.PrincipalAuthProviderGitlab {
profileLink = "https://docs.gitlab.com/ee/user/profile/#set-your-public-email"
}
return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Please configure your public email first, %s.", profileLink))
diff --git a/backend/server/oauth.go b/backend/server/oauth.go
index 850dd9e6ac..96deb7ae3c 100644
--- a/backend/server/oauth.go
+++ b/backend/server/oauth.go
@@ -55,7 +55,7 @@ func (s *Server) registerOAuthRoutes(g *echo.Group) {
}
} else {
vcsType = req.Type
- if vcsType != vcsPlugin.GitLabSelfHost && vcsType != vcsPlugin.GitHubCom {
+ if vcsType != vcsPlugin.GitLab && vcsType != vcsPlugin.GitHub {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Unexpected VCS type: %s", vcsType))
}
diff --git a/backend/server/project.go b/backend/server/project.go
index c1513d2b2e..5257e01a93 100644
--- a/backend/server/project.go
+++ b/backend/server/project.go
@@ -893,10 +893,10 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
var sheetSource api.SheetSource
switch vcs.Type {
- case vcsPlugin.GitLabSelfHost:
- sheetSource = api.SheetFromGitLabSelfHost
- case vcsPlugin.GitHubCom:
- sheetSource = api.SheetFromGitHubCom
+ case vcsPlugin.GitLab:
+ sheetSource = api.SheetFromGitLab
+ case vcsPlugin.GitHub:
+ sheetSource = api.SheetFromGitHub
}
vscSheetType := api.SheetForSQL
sheetFind := &api.SheetFind{
@@ -977,11 +977,11 @@ func (s *Server) setupVCSSQLReviewCI(ctx context.Context, repository *api.Reposi
sqlReviewEndpoint := fmt.Sprintf("%s/hook/sql-review/%s", s.profile.ExternalURL, repository.WebhookEndpointID)
switch repository.VCS.Type {
- case vcsPlugin.GitHubCom:
+ case vcsPlugin.GitHub:
if err := s.setupVCSSQLReviewCIForGitHub(ctx, repository, branch, sqlReviewEndpoint); err != nil {
return nil, err
}
- case vcsPlugin.GitLabSelfHost:
+ case vcsPlugin.GitLab:
if err := s.setupVCSSQLReviewCIForGitLab(ctx, repository, branch, sqlReviewEndpoint); err != nil {
return nil, err
}
@@ -1237,7 +1237,7 @@ func (s *Server) createVCSWebhook(ctx context.Context, vcsType vcsPlugin.Type, w
var webhookCreatePayload []byte
var err error
switch vcsType {
- case vcsPlugin.GitLabSelfHost:
+ case vcsPlugin.GitLab:
webhookCreate := gitlab.WebhookCreate{
URL: fmt.Sprintf("%s/hook/gitlab/%s", s.profile.ExternalURL, webhookEndpointID),
SecretToken: secretToken,
@@ -1248,7 +1248,7 @@ func (s *Server) createVCSWebhook(ctx context.Context, vcsType vcsPlugin.Type, w
if err != nil {
return "", errors.Wrap(err, "failed to marshal request body for creating webhook")
}
- case vcsPlugin.GitHubCom:
+ case vcsPlugin.GitHub:
webhookPost := github.WebhookCreateOrUpdate{
Config: github.WebhookConfig{
URL: fmt.Sprintf("%s/hook/github/%s", s.profile.ExternalURL, webhookEndpointID),
diff --git a/backend/server/webhook.go b/backend/server/webhook.go
index b69ecaf1eb..86cf46a8cd 100644
--- a/backend/server/webhook.go
+++ b/backend/server/webhook.go
@@ -259,9 +259,9 @@ func (s *Server) registerWebhookRoutes(g *echo.Group) {
response := &api.VCSSQLReviewResult{}
switch repo.VCS.Type {
- case vcs.GitHubCom:
+ case vcs.GitHub:
response = convertSQLAdviceToGitHubActionResult(sqlCheckAdvice)
- case vcs.GitLabSelfHost:
+ case vcs.GitLab:
response = convertSQLAdviceToGitLabCIResult(sqlCheckAdvice)
}
diff --git a/backend/store/demo/default/10110##task.sql b/backend/store/demo/default/10110##task.sql
index 7d1d2ef441..9f8ff54696 100644
--- a/backend/store/demo/default/10110##task.sql
+++ b/backend/store/demo/default/10110##task.sql
@@ -60,7 +60,7 @@ VALUES
'Add initial schema',
'bb.task.database.schema.update',
'DONE',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop##v1##baseline##add_initial_schema.sql"}}}'
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop##v1##baseline##add_initial_schema.sql"}}}'
);
-- Task for stage 10003 "Integration" to update database 7007 'shop'
@@ -94,7 +94,7 @@ VALUES
'Add initial schema',
'bb.task.database.schema.update',
'DONE',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop##v1##baseline##add_initial_schema.sql"}}}'
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop##v1##baseline##add_initial_schema.sql"}}}'
);
-- Task for stage 10004 "Staging" to update database 7011 'shop'
@@ -128,7 +128,7 @@ VALUES
'Add initial schema',
'bb.task.database.schema.update',
'PENDING_APPROVAL',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop##v1##baseline##add_initial_schema.sql"}}}'
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop##v1##baseline##add_initial_schema.sql"}}}'
);
-- Task for stage 10005 "Prod" to update database 7015 'proddb1'
@@ -162,7 +162,7 @@ VALUES
'Add initial schema',
'bb.task.database.schema.update',
'PENDING_APPROVAL',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop##v1##baseline##add_initial_schema.sql"}}}'
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop##v1##baseline##add_initial_schema.sql"}}}'
);
-- Task for Pipeline 9003 create table
@@ -257,7 +257,7 @@ VALUES
'Add initial schema',
'bb.task.database.schema.update',
'DONE',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8f578d53e821c46421d69fd0aabd29921190a6c0","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8f578d53e821c46421d69fd0aabd29921190a6c0","authorName":"tianzhou","added":"bytebase/dev/blog##202106280000##baseline##add_initial_schema.sql"}}}'
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8f578d53e821c46421d69fd0aabd29921190a6c0","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8f578d53e821c46421d69fd0aabd29921190a6c0","authorName":"tianzhou","added":"bytebase/dev/blog##202106280000##baseline##add_initial_schema.sql"}}}'
);
-- Task for stage 10009 simulating webhook push event
@@ -291,7 +291,7 @@ VALUES
'Add initial schema',
'bb.task.database.schema.update',
'DONE',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"0765950c28c50dd07217aa0a133e8239e64f0ea1","title":"Create user, post, comment table for integration environment","message":"Create user, post, comment table for integration environment","createdTs":1624866787,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/0765950c28c50dd07217aa0a133e8239e64f0ea1","authorName":"tianzhou","added":"bytebase/integration/blog##202106280000##baseline##add_initial_schema.sql"}}}'
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"0765950c28c50dd07217aa0a133e8239e64f0ea1","title":"Create user, post, comment table for integration environment","message":"Create user, post, comment table for integration environment","createdTs":1624866787,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/0765950c28c50dd07217aa0a133e8239e64f0ea1","authorName":"tianzhou","added":"bytebase/integration/blog##202106280000##baseline##add_initial_schema.sql"}}}'
);
-- Task for stage 10010 simulating webhook push event
@@ -325,7 +325,7 @@ VALUES
'Add initial schema',
'bb.task.database.schema.update',
'DONE',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"149f18b8d94805be4b92e256ef1dc9f4a27d5157","title":"Create user, post, comment table for staging environment","message":"Create user, post, comment table for staging environment","createdTs":1624868403,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/149f18b8d94805be4b92e256ef1dc9f4a27d5157","authorName":"tianzhou","added":"bytebase/bytebase/staging/blog##202106280000##baseline##add_initial_schema.sql"}}}'
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"149f18b8d94805be4b92e256ef1dc9f4a27d5157","title":"Create user, post, comment table for staging environment","message":"Create user, post, comment table for staging environment","createdTs":1624868403,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/149f18b8d94805be4b92e256ef1dc9f4a27d5157","authorName":"tianzhou","added":"bytebase/bytebase/staging/blog##202106280000##baseline##add_initial_schema.sql"}}}'
);
-- Task for stage 10011 simulating webhook push event
@@ -359,7 +359,7 @@ VALUES
'Add initial schema',
'bb.task.database.schema.update',
'DONE',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"ec17d38d6581015feb49b341cc3da56cb0e354fb","title":"Create user, post, comment table for prod environment","message":"Create user, post, comment table for prod environment","createdTs":1624868676,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/ec17d38d6581015feb49b341cc3da56cb0e354fb","authorName":"tianzhou","added":"bytebase/prod/blog##202106280000##baseline##add_initial_schema.sql"}}}'
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"ec17d38d6581015feb49b341cc3da56cb0e354fb","title":"Create user, post, comment table for prod environment","message":"Create user, post, comment table for prod environment","createdTs":1624868676,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/ec17d38d6581015feb49b341cc3da56cb0e354fb","authorName":"tianzhou","added":"bytebase/prod/blog##202106280000##baseline##add_initial_schema.sql"}}}'
);
-- Task for stage 10012 simulating webhook push event
@@ -393,7 +393,7 @@ VALUES
'Add created at column',
'bb.task.database.schema.update',
'FAILED',
- '{"migrationType":"MIGRATE","statement":"ALTER TABLE `user` ADD COLUMN `created_at` DATETIME NOT NULL;\n\nALTER TABLE post ADD COLUMN `created_at` DATETIME NOT NULL;\n\nALTER TABLE comment ADD COLUMN `created_at` DATETIME NOT NULL;\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8ff6482998059a861e1faa14658c65244577b54e","title":"Add created_at column to user,post,comment table for dev environment","message":"Add created_at column to user,post,comment table for dev environment","createdTs":1624869938,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8ff6482998059a861e1faa14658c65244577b54e","authorName":"tianzhou","added":"bytebase/dev/blog##202106280100##migrate##add_created_at_column.sql"}}}'
+ '{"migrationType":"MIGRATE","statement":"ALTER TABLE `user` ADD COLUMN `created_at` DATETIME NOT NULL;\n\nALTER TABLE post ADD COLUMN `created_at` DATETIME NOT NULL;\n\nALTER TABLE comment ADD COLUMN `created_at` DATETIME NOT NULL;\n","pushEvent":{"vcsType":"GITLAB","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8ff6482998059a861e1faa14658c65244577b54e","title":"Add created_at column to user,post,comment table for dev environment","message":"Add created_at column to user,post,comment table for dev environment","createdTs":1624869938,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8ff6482998059a861e1faa14658c65244577b54e","authorName":"tianzhou","added":"bytebase/dev/blog##202106280100##migrate##add_created_at_column.sql"}}}'
);
-- Task for Pipeline 9009 multi-stage create table UI workflow
diff --git a/backend/store/demo/default/10120##task_run.sql b/backend/store/demo/default/10120##task_run.sql
index 840d9300e6..4d1d38fac9 100644
--- a/backend/store/demo/default/10120##task_run.sql
+++ b/backend/store/demo/default/10120##task_run.sql
@@ -27,7 +27,7 @@ VALUES
'bb.task.database.schema.update',
0,
'{"detail":"Established baseline version 202106280000 for database ''shop''","migrationId":1,"version":"202106280000"}',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop##v1##baseline##add_initial_schema.sql"}}}'
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop##v1##baseline##add_initial_schema.sql"}}}'
);
-- Task run for task 11003
@@ -59,7 +59,7 @@ VALUES
'bb.task.database.schema.update',
0,
'{"detail":"Established baseline version 202106280000 for database ''shop''","migrationId":1,"version":"202106280000"}',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop##v1##baseline##add_initial_schema.sql"}}}'
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop##v1##baseline##add_initial_schema.sql"}}}'
);
-- Failed task run for task 11006 create table
@@ -117,7 +117,7 @@ VALUES
'bb.task.database.schema.update',
0,
'{"detail":"Established baseline version 202106280000 for database ''blog''","migrationId":1,"version":"202106280000"}',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8f578d53e821c46421d69fd0aabd29921190a6c0","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8f578d53e821c46421d69fd0aabd29921190a6c0","authorName":"tianzhou","added":"bytebase/dev/blog##202106280000##baseline##add_initial_schema.sql"}}}'
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8f578d53e821c46421d69fd0aabd29921190a6c0","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8f578d53e821c46421d69fd0aabd29921190a6c0","authorName":"tianzhou","added":"bytebase/dev/blog##202106280000##baseline##add_initial_schema.sql"}}}'
);
-- Task run for task 11009
@@ -149,7 +149,7 @@ VALUES
'bb.task.database.schema.update',
0,
'{"detail":"Established baseline version 202106280000 for database ''blog''","migrationId":1,"version":"202106280000"}',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8f578d53e821c46421d69fd0aabd29921190a6c0","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8f578d53e821c46421d69fd0aabd29921190a6c0","authorName":"tianzhou","added":"bytebase/dev/blog##202106280000##baseline##add_initial_schema.sql"}}}'
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8f578d53e821c46421d69fd0aabd29921190a6c0","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8f578d53e821c46421d69fd0aabd29921190a6c0","authorName":"tianzhou","added":"bytebase/dev/blog##202106280000##baseline##add_initial_schema.sql"}}}'
);
-- Task run for task 11010
@@ -181,7 +181,7 @@ VALUES
'bb.task.database.schema.update',
0,
'{"detail":"Established baseline version 202106280000 for database ''blog''","migrationId":1,"version":"202106280000"}',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8f578d53e821c46421d69fd0aabd29921190a6c0","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8f578d53e821c46421d69fd0aabd29921190a6c0","authorName":"tianzhou","added":"bytebase/dev/blog##202106280000##baseline##add_initial_schema.sql"}}}'
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8f578d53e821c46421d69fd0aabd29921190a6c0","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8f578d53e821c46421d69fd0aabd29921190a6c0","authorName":"tianzhou","added":"bytebase/dev/blog##202106280000##baseline##add_initial_schema.sql"}}}'
);
-- Task run for task 11011
@@ -213,7 +213,7 @@ VALUES
'bb.task.database.schema.update',
0,
'{"detail":"Established baseline version 202106280000 for database ''blog''","migrationId":1,"version":"202106280000"}',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8f578d53e821c46421d69fd0aabd29921190a6c0","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8f578d53e821c46421d69fd0aabd29921190a6c0","authorName":"tianzhou","added":"bytebase/dev/blog##202106280000##baseline##add_initial_schema.sql"}}}'
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8f578d53e821c46421d69fd0aabd29921190a6c0","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8f578d53e821c46421d69fd0aabd29921190a6c0","authorName":"tianzhou","added":"bytebase/dev/blog##202106280000##baseline##add_initial_schema.sql"}}}'
);
-- Failed task run for task 11012 create table
@@ -245,7 +245,7 @@ VALUES
'bb.task.database.schema.update',
201,
'{"detail":"database ''blog'' has already applied version 202106280100"}',
- '{"migrationType":"MIGRATE","statement":"ALTER TABLE `user` ADD COLUMN `created_at` DATETIME NOT NULL;\n\nALTER TABLE post ADD COLUMN `created_at` DATETIME NOT NULL;\n\nALTER TABLE comment ADD COLUMN `created_at` DATETIME NOT NULL;\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8ff6482998059a861e1faa14658c65244577b54e","title":"Add created_at column to user,post,comment table for dev environment","message":"Add created_at column to user,post,comment table for dev environment","createdTs":1624869938,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8ff6482998059a861e1faa14658c65244577b54e","authorName":"tianzhou","added":"bytebase/dev/blog##202106280100##migrate##add_created_at_column.sql"}}}'
+ '{"migrationType":"MIGRATE","statement":"ALTER TABLE `user` ADD COLUMN `created_at` DATETIME NOT NULL;\n\nALTER TABLE post ADD COLUMN `created_at` DATETIME NOT NULL;\n\nALTER TABLE comment ADD COLUMN `created_at` DATETIME NOT NULL;\n","pushEvent":{"vcsType":"GITLAB","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8ff6482998059a861e1faa14658c65244577b54e","title":"Add created_at column to user,post,comment table for dev environment","message":"Add created_at column to user,post,comment table for dev environment","createdTs":1624869938,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8ff6482998059a861e1faa14658c65244577b54e","authorName":"tianzhou","added":"bytebase/dev/blog##202106280100##migrate##add_created_at_column.sql"}}}'
);
-- Successful task run for task 10013 create table
diff --git a/backend/store/demo/default/10140##activity.sql b/backend/store/demo/default/10140##activity.sql
index 473110405a..15b4583057 100644
--- a/backend/store/demo/default/10140##activity.sql
+++ b/backend/store/demo/default/10140##activity.sql
@@ -1107,7 +1107,7 @@ VALUES
'bb.project.repository.push',
'INFO',
'Created issue "Create product table using multi-stage VCS workflow".',
- '{"pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs": 1630940811,"url":"https://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop##v1##baseline##add_initial_schema.sql"}},"issueId":13002,"issueName":"Create product table using multi-stage VCS workflow"}'
+ '{"pushEvent":{"vcsType":"GITLAB","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs": 1630940811,"url":"https://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop##v1##baseline##add_initial_schema.sql"}},"issueId":13002,"issueName":"Create product table using multi-stage VCS workflow"}'
);
-- Project activity for 3003
@@ -1162,7 +1162,7 @@ VALUES
'bb.project.repository.push',
'INFO',
'Created issue "Add created_at column to user,post,comment table for dev environment".',
- '{"pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8ff6482998059a861e1faa14658c65244577b54e","title":"Add created_at column to user,post,comment table for dev environment","message":"Add created_at column to user,post,comment table for dev environment","createdTs":1630943211,"url":"https://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8ff6482998059a861e1faa14658c65244577b54e","authorName":"tianzhou","added":"bytebase/dev/blog##202106280100##migrate##add_created_at_column.sql"}},"issueId":13008,"issueName":"Add created_at column to user,post,comment table for dev environment"}'
+ '{"pushEvent":{"vcsType":"GITLAB","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8ff6482998059a861e1faa14658c65244577b54e","title":"Add created_at column to user,post,comment table for dev environment","message":"Add created_at column to user,post,comment table for dev environment","createdTs":1630943211,"url":"https://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8ff6482998059a861e1faa14658c65244577b54e","authorName":"tianzhou","added":"bytebase/dev/blog##202106280100##migrate##add_created_at_column.sql"}},"issueId":13008,"issueName":"Add created_at column to user,post,comment table for dev environment"}'
);
INSERT INTO
@@ -1189,7 +1189,7 @@ VALUES
'bb.project.repository.push',
'INFO',
'Created issue "Create user, post, comment table for dev environment".',
- '{"pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8f578d53e821c46421d69fd0aabd29921190a6c0","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs": 1630941711,"url":"https://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8f578d53e821c46421d69fd0aabd29921190a6c0","authorName":"tianzhou","added":"bytebase/dev/blog##202106280000##baseline##add_initial_schema.sql"}},"issueId":13004,"issueName":"Create user, post, comment table for dev environment"}'
+ '{"pushEvent":{"vcsType":"GITLAB","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8f578d53e821c46421d69fd0aabd29921190a6c0","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs": 1630941711,"url":"https://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8f578d53e821c46421d69fd0aabd29921190a6c0","authorName":"tianzhou","added":"bytebase/dev/blog##202106280000##baseline##add_initial_schema.sql"}},"issueId":13004,"issueName":"Create user, post, comment table for dev environment"}'
);
INSERT INTO
@@ -1216,7 +1216,7 @@ VALUES
'bb.project.repository.push',
'INFO',
'Created issue "Create user, post, comment table for integration environment".',
- '{"pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"0765950c28c50dd07217aa0a133e8239e64f0ea1","title":"Create user, post, comment table for integration environment","message":"Create user, post, comment table for integration environment","createdTs": 1630941711,"url":"https://gitlab.bytebase.com/bytebase-demo/blog/-/commit/0765950c28c50dd07217aa0a133e8239e64f0ea1","authorName":"tianzhou","added":"bytebase/integration/blog##202106280000##baseline##add_initial_schema.sql"}},"issueId":13005,"issueName":"Create user, post, comment table for integration environment"}'
+ '{"pushEvent":{"vcsType":"GITLAB","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"0765950c28c50dd07217aa0a133e8239e64f0ea1","title":"Create user, post, comment table for integration environment","message":"Create user, post, comment table for integration environment","createdTs": 1630941711,"url":"https://gitlab.bytebase.com/bytebase-demo/blog/-/commit/0765950c28c50dd07217aa0a133e8239e64f0ea1","authorName":"tianzhou","added":"bytebase/integration/blog##202106280000##baseline##add_initial_schema.sql"}},"issueId":13005,"issueName":"Create user, post, comment table for integration environment"}'
);
INSERT INTO
@@ -1243,7 +1243,7 @@ VALUES
'bb.project.repository.push',
'INFO',
'Created issue "Create user, post, comment table for staging environment".',
- '{"pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"149f18b8d94805be4b92e256ef1dc9f4a27d5157","title":"Create user, post, comment table for staging environment","message":"Create user, post, comment table for staging environment","createdTs": 1630941711,"url":"https://gitlab.bytebase.com/bytebase-demo/blog/-/commit/149f18b8d94805be4b92e256ef1dc9f4a27d5157","authorName":"tianzhou","added":"bytebase/staging/blog##202106280000##baseline##add_initial_schema.sql"}},"issueId":13006,"issueName":"Create user, post, comment table for staging environment"}'
+ '{"pushEvent":{"vcsType":"GITLAB","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"149f18b8d94805be4b92e256ef1dc9f4a27d5157","title":"Create user, post, comment table for staging environment","message":"Create user, post, comment table for staging environment","createdTs": 1630941711,"url":"https://gitlab.bytebase.com/bytebase-demo/blog/-/commit/149f18b8d94805be4b92e256ef1dc9f4a27d5157","authorName":"tianzhou","added":"bytebase/staging/blog##202106280000##baseline##add_initial_schema.sql"}},"issueId":13006,"issueName":"Create user, post, comment table for staging environment"}'
);
INSERT INTO
@@ -1270,7 +1270,7 @@ VALUES
'bb.project.repository.push',
'INFO',
'Created issue "Create user, post, comment table for prod environment".',
- '{"pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"ec17d38d6581015feb49b341cc3da56cb0e354fb","title":"Create user, post, comment table for prod environment","message":"Create user, post, comment table for prod environment","createdTs": 1630941711,"url":"https://gitlab.bytebase.com/bytebase-demo/blog/-/commit/ec17d38d6581015feb49b341cc3da56cb0e354fb","authorName":"tianzhou","added":"bytebase/prod/blog##202106280000##baseline##add_initial_schema.sql"}},"issueId":13006,"issueName":"Create user, post, comment table for prod environment"}'
+ '{"pushEvent":{"vcsType":"GITLAB","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"ec17d38d6581015feb49b341cc3da56cb0e354fb","title":"Create user, post, comment table for prod environment","message":"Create user, post, comment table for prod environment","createdTs": 1630941711,"url":"https://gitlab.bytebase.com/bytebase-demo/blog/-/commit/ec17d38d6581015feb49b341cc3da56cb0e354fb","authorName":"tianzhou","added":"bytebase/prod/blog##202106280000##baseline##add_initial_schema.sql"}},"issueId":13006,"issueName":"Create user, post, comment table for prod environment"}'
);
ALTER SEQUENCE activity_id_seq RESTART WITH 14049;
diff --git a/backend/store/demo/default/10170##vcs.sql b/backend/store/demo/default/10170##vcs.sql
index 7122ce7c18..393f2a6f62 100644
--- a/backend/store/demo/default/10170##vcs.sql
+++ b/backend/store/demo/default/10170##vcs.sql
@@ -17,7 +17,7 @@ VALUES
101,
101,
'bytebase.gitlab.com',
- 'GITLAB_SELF_HOST',
+ 'GITLAB',
'https://gitlab.bytebase.com',
'https://gitlab.bytebase.com/api/v4',
'fda62e44b5388b1ca6e72d5a7028a3c2c47157fc13fd98328e2bd446fae98fd8',
diff --git a/backend/store/migration/dev/LATEST.sql b/backend/store/migration/dev/LATEST.sql
index 40af16371f..96447686a8 100644
--- a/backend/store/migration/dev/LATEST.sql
+++ b/backend/store/migration/dev/LATEST.sql
@@ -779,7 +779,7 @@ CREATE TABLE vcs (
updater_id INTEGER NOT NULL REFERENCES principal (id),
updated_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),
name TEXT NOT NULL,
- type TEXT NOT NULL CHECK (type IN ('GITLAB_SELF_HOST', 'GITHUB_COM')),
+ type TEXT NOT NULL CHECK (type IN ('GITLAB', 'GITHUB', 'BITBUCKET')),
instance_url TEXT NOT NULL CHECK ((instance_url LIKE 'http://%' OR instance_url LIKE 'https://%') AND instance_url = rtrim(instance_url, '/')),
api_url TEXT NOT NULL CHECK ((api_url LIKE 'http://%' OR api_url LIKE 'https://%') AND api_url = rtrim(api_url, '/')),
application_id TEXT NOT NULL,
@@ -992,7 +992,7 @@ CREATE TABLE sheet (
name TEXT NOT NULL,
statement TEXT NOT NULL,
visibility TEXT NOT NULL CHECK (visibility IN ('PRIVATE', 'PROJECT', 'PUBLIC')) DEFAULT 'PRIVATE',
- source TEXT NOT NULL CHECK (source IN ('BYTEBASE', 'GITLAB_SELF_HOST', 'GITHUB_COM')) DEFAULT 'BYTEBASE',
+ source TEXT NOT NULL CHECK (source IN ('BYTEBASE', 'GITLAB', 'GITHUB', 'BITBUCKET')) DEFAULT 'BYTEBASE',
type TEXT NOT NULL CHECK (type IN ('SQL')) DEFAULT 'SQL',
payload JSONB NOT NULL DEFAULT '{}'
);
diff --git a/backend/store/migration/prod/1.13/0000##gitlab_github_bitbucket.sql b/backend/store/migration/prod/1.13/0000##gitlab_github_bitbucket.sql
new file mode 100644
index 0000000000..c709e1737b
--- /dev/null
+++ b/backend/store/migration/prod/1.13/0000##gitlab_github_bitbucket.sql
@@ -0,0 +1,10 @@
+ALTER TABLE vcs DROP CONSTRAINT vcs_type_check;
+ALTER TABLE sheet DROP CONSTRAINT sheet_source_check;
+
+UPDATE vcs SET type = 'GITLAB' WHERE type = 'GITLAB_SELF_HOST';
+UPDATE vcs SET type = 'GITHUB' WHERE type = 'GITHUB_COM';
+UPDATE sheet SET source = 'GITLAB' WHERE source = 'GITLAB_SELF_HOST';
+UPDATE sheet SET source = 'GITHUB' WHERE source = 'GITHUB_COM';
+
+ALTER TABLE vcs ADD CONSTRAINT vcs_type_check CHECK (type IN ('GITLAB', 'GITHUB', 'BITBUCKET'));
+ALTER TABLE sheet ADD CONSTRAINT sheet_source_check CHECK (source IN ('BYTEBASE', 'GITLAB', 'GITHUB', 'BITBUCKET'));
\ No newline at end of file
diff --git a/backend/store/migration/prod/LATEST.sql b/backend/store/migration/prod/LATEST.sql
index 1cebc8b342..d240d2d72f 100644
--- a/backend/store/migration/prod/LATEST.sql
+++ b/backend/store/migration/prod/LATEST.sql
@@ -778,7 +778,7 @@ CREATE TABLE vcs (
updater_id INTEGER NOT NULL REFERENCES principal (id),
updated_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),
name TEXT NOT NULL,
- type TEXT NOT NULL CHECK (type IN ('GITLAB_SELF_HOST', 'GITHUB_COM')),
+ type TEXT NOT NULL CHECK (type IN ('GITLAB', 'GITHUB', 'BITBUCKET')),
instance_url TEXT NOT NULL CHECK ((instance_url LIKE 'http://%' OR instance_url LIKE 'https://%') AND instance_url = rtrim(instance_url, '/')),
api_url TEXT NOT NULL CHECK ((api_url LIKE 'http://%' OR api_url LIKE 'https://%') AND api_url = rtrim(api_url, '/')),
application_id TEXT NOT NULL,
@@ -991,7 +991,7 @@ CREATE TABLE sheet (
name TEXT NOT NULL,
statement TEXT NOT NULL,
visibility TEXT NOT NULL CHECK (visibility IN ('PRIVATE', 'PROJECT', 'PUBLIC')) DEFAULT 'PRIVATE',
- source TEXT NOT NULL CHECK (source IN ('BYTEBASE', 'GITLAB_SELF_HOST', 'GITHUB_COM')) DEFAULT 'BYTEBASE',
+ source TEXT NOT NULL CHECK (source IN ('BYTEBASE', 'GITLAB', 'GITHUB', 'BITBUCKET')) DEFAULT 'BYTEBASE',
type TEXT NOT NULL CHECK (type IN ('SQL')) DEFAULT 'SQL',
payload JSONB NOT NULL DEFAULT '{}'
);
diff --git a/backend/store/pg_engine_test.go b/backend/store/pg_engine_test.go
index b4d6891068..2ef2f7a881 100644
--- a/backend/store/pg_engine_test.go
+++ b/backend/store/pg_engine_test.go
@@ -220,5 +220,5 @@ func TestMigrationCompatibility(t *testing.T) {
func TestGetCutoffVersion(t *testing.T) {
releaseVersion, err := getProdCutoffVersion()
require.NoError(t, err)
- require.Equal(t, semver.MustParse("1.12.7"), releaseVersion)
+ require.Equal(t, semver.MustParse("1.13.0"), releaseVersion)
}
diff --git a/backend/tests/schema_update_test.go b/backend/tests/schema_update_test.go
index d7bf47ab89..161b50ee6d 100644
--- a/backend/tests/schema_update_test.go
+++ b/backend/tests/schema_update_test.go
@@ -283,7 +283,7 @@ func TestVCS1(t *testing.T) {
{
name: "GitLab",
vcsProviderCreator: fake.NewGitLab,
- vcsType: vcs.GitLabSelfHost,
+ vcsType: vcs.GitLab,
externalID: "121",
repositoryFullPath: "test/schemaUpdate",
newWebhookPushEvent: func(added, modified [][]string, beforeSHA, afterSHA string) interface{} {
@@ -310,7 +310,7 @@ func TestVCS1(t *testing.T) {
{
name: "GitHub",
vcsProviderCreator: fake.NewGitHub,
- vcsType: vcs.GitHubCom,
+ vcsType: vcs.GitHub,
externalID: "octocat/Hello-World",
repositoryFullPath: "octocat/Hello-World",
newWebhookPushEvent: func(added, modified [][]string, beforeSHA, afterSHA string) interface{} {
@@ -694,7 +694,7 @@ func TestVCS_SDL(t *testing.T) {
{
name: "GitLab",
vcsProviderCreator: fake.NewGitLab,
- vcsType: vcs.GitLabSelfHost,
+ vcsType: vcs.GitLab,
externalID: "121",
repositoryFullPath: "test/schemaUpdate",
newWebhookPushEvent: func(added, modified []string, beforeSHA, afterSHA string) interface{} {
@@ -719,7 +719,7 @@ func TestVCS_SDL(t *testing.T) {
{
name: "GitHub",
vcsProviderCreator: fake.NewGitHub,
- vcsType: vcs.GitHubCom,
+ vcsType: vcs.GitHub,
externalID: "octocat/Hello-World",
repositoryFullPath: "octocat/Hello-World",
newWebhookPushEvent: func(added, modified []string, beforeSHA, afterSHA string) interface{} {
@@ -1106,7 +1106,7 @@ func TestWildcardInVCSFilePathTemplate(t *testing.T) {
{
name: "singleAsterisk",
vcsProviderCreator: fake.NewGitLab,
- vcsType: vcs.GitLabSelfHost,
+ vcsType: vcs.GitLab,
baseDirectory: "bbtest",
envName: "wildcard",
filePathTemplate: "{{ENV_NAME}}/*/{{DB_NAME}}##{{VERSION}}##{{TYPE}}##{{DESCRIPTION}}.sql",
@@ -1133,7 +1133,7 @@ func TestWildcardInVCSFilePathTemplate(t *testing.T) {
{
name: "doubleAsterisks",
vcsProviderCreator: fake.NewGitLab,
- vcsType: vcs.GitLabSelfHost,
+ vcsType: vcs.GitLab,
baseDirectory: "bbtest",
envName: "wildcard",
filePathTemplate: "{{ENV_NAME}}/**/{{DB_NAME}}##{{VERSION}}##{{TYPE}}##{{DESCRIPTION}}.sql",
@@ -1166,7 +1166,7 @@ func TestWildcardInVCSFilePathTemplate(t *testing.T) {
vcsProviderCreator: fake.NewGitLab,
envName: "wildcard",
baseDirectory: "",
- vcsType: vcs.GitLabSelfHost,
+ vcsType: vcs.GitLab,
filePathTemplate: "{{ENV_NAME}}/**/foo/*/{{DB_NAME}}##{{VERSION}}##{{TYPE}}##{{DESCRIPTION}}.sql",
commitNewFileNames: []string{
// ** matches foo, foo matches foo, * matches bar
@@ -1194,7 +1194,7 @@ func TestWildcardInVCSFilePathTemplate(t *testing.T) {
vcsProviderCreator: fake.NewGitLab,
envName: "prod1",
baseDirectory: "bbtest",
- vcsType: vcs.GitLabSelfHost,
+ vcsType: vcs.GitLab,
filePathTemplate: "{{ENV_NAME}}/**/foo/*/{{DB_NAME}}##{{VERSION}}##{{TYPE}}##{{DESCRIPTION}}.sql",
commitNewFileNames: []string{
// ** matches foo, foo matches foo, * matches bar
@@ -1222,7 +1222,7 @@ func TestWildcardInVCSFilePathTemplate(t *testing.T) {
vcsProviderCreator: fake.NewGitLab,
envName: "ZO",
baseDirectory: "bbtest",
- vcsType: vcs.GitLabSelfHost,
+ vcsType: vcs.GitLab,
filePathTemplate: "{{ENV_NAME}}/{{DB_NAME}}/sql/{{DB_NAME}}##{{VERSION}}##{{TYPE}}##{{DESCRIPTION}}.sql",
commitNewFileNames: []string{
fmt.Sprintf("%s/%s/%s/sql/%s##ver1##migrate##create_table_t1.sql", baseDirectory, "ZO", dbName, dbName),
@@ -1387,7 +1387,7 @@ func TestVCS_SQL_Review(t *testing.T) {
{
name: "GitLab",
vcsProviderCreator: fake.NewGitLab,
- vcsType: vcs.GitLabSelfHost,
+ vcsType: vcs.GitLab,
externalID: "121",
repositoryFullPath: "test/schemaUpdate",
getEmptySQLReviewResult: func(repo *api.Repository, filePath, rootURL string) *api.VCSSQLReviewResult {
@@ -1423,7 +1423,7 @@ func TestVCS_SQL_Review(t *testing.T) {
{
name: "GitHub",
vcsProviderCreator: fake.NewGitHub,
- vcsType: vcs.GitHubCom,
+ vcsType: vcs.GitHub,
externalID: "octocat/Hello-World",
repositoryFullPath: "octocat/Hello-World",
getEmptySQLReviewResult: func(repo *api.Repository, filePath, rootURL string) *api.VCSSQLReviewResult {
@@ -1654,7 +1654,7 @@ func TestBranchNameInVCSSetupAndUpdate(t *testing.T) {
tests := []vcsTestCase{
{
- vcsType: vcs.GitLabSelfHost,
+ vcsType: vcs.GitLab,
vcsProviderCreator: fake.NewGitLab,
externalID: "1234",
repoFullPath: "1234",
@@ -1694,7 +1694,7 @@ func TestBranchNameInVCSSetupAndUpdate(t *testing.T) {
},
},
{
- vcsType: vcs.GitHubCom,
+ vcsType: vcs.GitHub,
vcsProviderCreator: fake.NewGitHub,
externalID: "test/branch",
repoFullPath: "test/branch",
@@ -2214,7 +2214,7 @@ func TestVCS_SDL_MySQL(t *testing.T) {
{
name: "GitLab",
vcsProviderCreator: fake.NewGitLab,
- vcsType: vcs.GitLabSelfHost,
+ vcsType: vcs.GitLab,
externalID: "121",
repositoryFullPath: "test/schemaUpdate",
newWebhookPushEvent: func(added, modified []string, beforeSHA, afterSHA string) interface{} {
@@ -2239,7 +2239,7 @@ func TestVCS_SDL_MySQL(t *testing.T) {
{
name: "GitHub",
vcsProviderCreator: fake.NewGitHub,
- vcsType: vcs.GitHubCom,
+ vcsType: vcs.GitHub,
externalID: "octocat/Hello-World",
repositoryFullPath: "octocat/Hello-World",
newWebhookPushEvent: func(added, modified []string, beforeSHA, afterSHA string) interface{} {
diff --git a/backend/tests/sheet_vcs_test.go b/backend/tests/sheet_vcs_test.go
index 73fc2dc471..03a5de0d40 100644
--- a/backend/tests/sheet_vcs_test.go
+++ b/backend/tests/sheet_vcs_test.go
@@ -24,14 +24,14 @@ func TestSheetVCS(t *testing.T) {
{
name: "GitLab",
vcsProviderCreator: fake.NewGitLab,
- vcsType: vcs.GitLabSelfHost,
+ vcsType: vcs.GitLab,
externalID: "121",
repositoryFullPath: "test/schemaUpdate",
},
{
name: "GitHub",
vcsProviderCreator: fake.NewGitHub,
- vcsType: vcs.GitHubCom,
+ vcsType: vcs.GitHub,
externalID: "octocat/Hello-World",
repositoryFullPath: "octocat/Hello-World",
},
diff --git a/backend/tests/tenant_test.go b/backend/tests/tenant_test.go
index b2742d31a1..26929c7f17 100644
--- a/backend/tests/tenant_test.go
+++ b/backend/tests/tenant_test.go
@@ -209,7 +209,7 @@ func TestTenantVCS(t *testing.T) {
{
name: "GitLab",
vcsProviderCreator: fake.NewGitLab,
- vcsType: vcs.GitLabSelfHost,
+ vcsType: vcs.GitLab,
externalID: "121",
repositoryFullPath: "test/schemaUpdate",
newWebhookPushEvent: func(gitFile, beforeSHA, afterSHA string) interface{} {
@@ -233,7 +233,7 @@ func TestTenantVCS(t *testing.T) {
{
name: "GitHub",
vcsProviderCreator: fake.NewGitHub,
- vcsType: vcs.GitHubCom,
+ vcsType: vcs.GitHub,
externalID: "octocat/Hello-World",
repositoryFullPath: "octocat/Hello-World",
newWebhookPushEvent: func(gitFile, beforeSHA, afterSHA string) interface{} {
@@ -649,7 +649,7 @@ func TestTenantVCSDatabaseNameTemplate(t *testing.T) {
{
name: "GitLab",
vcsProviderCreator: fake.NewGitLab,
- vcsType: vcs.GitLabSelfHost,
+ vcsType: vcs.GitLab,
externalID: "121",
repositoryFullPath: "test/schemaUpdate",
newWebhookPushEvent: func(gitFile, beforeSHA, afterSHA string) interface{} {
@@ -673,7 +673,7 @@ func TestTenantVCSDatabaseNameTemplate(t *testing.T) {
{
name: "GitHub",
vcsProviderCreator: fake.NewGitHub,
- vcsType: vcs.GitHubCom,
+ vcsType: vcs.GitHub,
externalID: "octocat/Hello-World",
repositoryFullPath: "octocat/Hello-World",
newWebhookPushEvent: func(gitFile, beforeSHA, afterSHA string) interface{} {
@@ -976,7 +976,7 @@ func TestTenantVCSDatabaseNameTemplate_Empty(t *testing.T) {
{
name: "GitLab",
vcsProviderCreator: fake.NewGitLab,
- vcsType: vcs.GitLabSelfHost,
+ vcsType: vcs.GitLab,
externalID: "121",
repositoryFullPath: "test/schemaUpdate",
newWebhookPushEvent: func(gitFile, beforeSHA, afterSHA string) interface{} {
@@ -1000,7 +1000,7 @@ func TestTenantVCSDatabaseNameTemplate_Empty(t *testing.T) {
{
name: "GitHub",
vcsProviderCreator: fake.NewGitHub,
- vcsType: vcs.GitHubCom,
+ vcsType: vcs.GitHub,
externalID: "octocat/Hello-World",
repositoryFullPath: "octocat/Hello-World",
newWebhookPushEvent: func(gitFile, beforeSHA, afterSHA string) interface{} {
@@ -1255,7 +1255,7 @@ func TestTenantVCS_YAML(t *testing.T) {
{
name: "GitLab",
vcsProviderCreator: fake.NewGitLab,
- vcsType: vcs.GitLabSelfHost,
+ vcsType: vcs.GitLab,
externalID: "121",
repositoryFullPath: "test/dataUpdate",
newWebhookPushEvent: func(gitFile, beforeSHA, afterSHA string) interface{} {
@@ -1279,7 +1279,7 @@ func TestTenantVCS_YAML(t *testing.T) {
{
name: "GitHub",
vcsProviderCreator: fake.NewGitHub,
- vcsType: vcs.GitHubCom,
+ vcsType: vcs.GitHub,
externalID: "octocat/Hello-World",
repositoryFullPath: "octocat/Hello-World",
newWebhookPushEvent: func(gitFile, beforeSHA, afterSHA string) interface{} {
diff --git a/frontend/src/components/Issue/IssueHighlightPanel.vue b/frontend/src/components/Issue/IssueHighlightPanel.vue
index 86791c8f90..45d21b2ef7 100644
--- a/frontend/src/components/Issue/IssueHighlightPanel.vue
+++ b/frontend/src/components/Issue/IssueHighlightPanel.vue
@@ -147,9 +147,9 @@ const vcsBranch = computed((): string => {
const vcsBranchUrl = computed((): string => {
if (pushEvent.value) {
- if (pushEvent.value.vcsType == "GITLAB_SELF_HOST") {
+ if (pushEvent.value.vcsType == "GITLAB") {
return `${pushEvent.value.repositoryUrl}/-/tree/${vcsBranch.value}`;
- } else if (pushEvent.value.vcsType == "GITHUB_COM") {
+ } else if (pushEvent.value.vcsType == "GITHUB") {
return `${pushEvent.value.repositoryUrl}/tree/${vcsBranch.value}`;
}
}
diff --git a/frontend/src/components/RepositorySelectionPanel.vue b/frontend/src/components/RepositorySelectionPanel.vue
index 10f964b127..5097e7232f 100644
--- a/frontend/src/components/RepositorySelectionPanel.vue
+++ b/frontend/src/components/RepositorySelectionPanel.vue
@@ -91,7 +91,7 @@ const prepareRepositoryList = () => {
};
const refreshRepositoryList = () => {
- if (props.config.vcs.type == "GITLAB_SELF_HOST") {
+ if (props.config.vcs.type == "GITLAB") {
gitlabStore
.fetchProjectList({
vcs: props.config.vcs,
@@ -113,9 +113,9 @@ const repositoryList = computed(() => {
});
const attentionText = computed((): string => {
- if (props.config.vcs.type == "GITLAB_SELF_HOST") {
+ if (props.config.vcs.type == "GITLAB") {
return "repository.select-repository-attention-gitlab";
- } else if (props.config.vcs.type == "GITHUB_COM") {
+ } else if (props.config.vcs.type == "GITHUB") {
return "repository.select-repository-attention-github";
}
return "";
diff --git a/frontend/src/components/RepositorySetupWizard.vue b/frontend/src/components/RepositorySetupWizard.vue
index b6eeaddcfc..487eb8e6ad 100644
--- a/frontend/src/components/RepositorySetupWizard.vue
+++ b/frontend/src/components/RepositorySetupWizard.vue
@@ -307,7 +307,7 @@ export default defineComponent({
const createFunc = async () => {
let externalId = state.config.repositoryInfo.externalId;
- if (state.config.vcs.type == "GITHUB_COM") {
+ if (state.config.vcs.type == "GITHUB") {
externalId = state.config.repositoryInfo.fullPath;
}
diff --git a/frontend/src/components/RepositoryVCSProviderPanel.vue b/frontend/src/components/RepositoryVCSProviderPanel.vue
index 0f6f5eb777..ad6d0462f1 100644
--- a/frontend/src/components/RepositoryVCSProviderPanel.vue
+++ b/frontend/src/components/RepositoryVCSProviderPanel.vue
@@ -105,7 +105,7 @@ const selectVCS = (vcs: VCS) => {
emit("set-vcs", vcs);
let authorizeUrl = `${vcs.instanceUrl}/oauth/authorize`;
- if (vcs.type == "GITHUB_COM") {
+ if (vcs.type == "GITHUB") {
authorizeUrl = `https://github.com/login/oauth/authorize`;
}
openWindowForOAuth(
diff --git a/frontend/src/components/VCSProviderBasicInfoPanel.vue b/frontend/src/components/VCSProviderBasicInfoPanel.vue
index 9ee68a4ab2..0e888c863c 100644
--- a/frontend/src/components/VCSProviderBasicInfoPanel.vue
+++ b/frontend/src/components/VCSProviderBasicInfoPanel.vue
@@ -12,7 +12,7 @@
tabindex="-1"
type="radio"
class="btn"
- value="GITLAB_SELF_HOST"
+ value="GITLAB"
@change="changeType()"
/>
<img class="h-6 w-auto" src="../assets/gitlab-logo.svg" />
@@ -27,7 +27,7 @@
tabindex="-1"
type="radio"
class="btn"
- value="GITHUB_COM"
+ value="GITHUB"
@change="changeType()"
/>
<img class="h-6 w-auto" src="../assets/github-logo.svg" />
@@ -127,20 +127,20 @@ export default defineComponent({
});
const namePlaceholder = computed((): string => {
- if (props.config.type == "GITLAB_SELF_HOST") {
+ if (props.config.type == "GITLAB") {
return t("gitops.setting.add-git-provider.gitlab-self-host");
- } else if (props.config.type == "GITHUB_COM") {
+ } else if (props.config.type == "GITHUB") {
return "GitHub.com";
}
return "";
});
const instanceUrlLabel = computed((): string => {
- if (props.config.type == "GITLAB_SELF_HOST") {
+ if (props.config.type == "GITLAB") {
return t(
"gitops.setting.add-git-provider.basic-info.gitlab-instance-url"
);
- } else if (props.config.type == "GITHUB_COM") {
+ } else if (props.config.type == "GITHUB") {
return t(
"gitops.setting.add-git-provider.basic-info.github-instance-url"
);
@@ -149,9 +149,9 @@ export default defineComponent({
});
const instanceUrlPlaceholder = computed((): string => {
- if (props.config.type == "GITLAB_SELF_HOST") {
+ if (props.config.type == "GITLAB") {
return "https://gitlab.example.com";
- } else if (props.config.type == "GITHUB_COM") {
+ } else if (props.config.type == "GITHUB") {
return "https://github.com";
}
return "";
@@ -159,7 +159,7 @@ export default defineComponent({
// github.com instance url is always https://github.com
const instanceUrlDisabled = computed((): boolean => {
- return props.config.type == "GITHUB_COM";
+ return props.config.type == "GITHUB";
});
const changeUrl = (value: string) => {
@@ -190,14 +190,14 @@ export default defineComponent({
// FIXME: Unexpected mutation of "config" prop. Do we care?
const changeType = () => {
- if (props.config.type == "GITLAB_SELF_HOST") {
+ if (props.config.type == "GITLAB") {
// eslint-disable-next-line vue/no-mutating-props
props.config.instanceUrl = "";
// eslint-disable-next-line vue/no-mutating-props
props.config.name = t(
"gitops.setting.add-git-provider.gitlab-self-host"
);
- } else if (props.config.type == "GITHUB_COM") {
+ } else if (props.config.type == "GITHUB") {
// eslint-disable-next-line vue/no-mutating-props
props.config.instanceUrl = "https://github.com";
// eslint-disable-next-line vue/no-mutating-props
diff --git a/frontend/src/components/VCSProviderConfirmPanel.vue b/frontend/src/components/VCSProviderConfirmPanel.vue
index 97296f473a..0a14cf8c9d 100644
--- a/frontend/src/components/VCSProviderConfirmPanel.vue
+++ b/frontend/src/components/VCSProviderConfirmPanel.vue
@@ -19,7 +19,7 @@
</dt>
<dd class="col-start-2 col-span-3 text-sm text-main">
<div
- v-if="config.type == 'GITLAB_SELF_HOST'"
+ v-if="config.type == 'GITLAB'"
class="flex flex-row items-center space-x-2"
>
<img class="h-6 w-auto" src="../assets/gitlab-logo.svg" />
@@ -28,7 +28,7 @@
</div>
</div>
<div
- v-if="config.type == 'GITHUB_COM'"
+ v-if="config.type == 'GITHUB'"
class="flex flex-row items-center space-x-2"
>
<img class="h-6 w-auto" src="../assets/github-logo.svg" />
diff --git a/frontend/src/components/VCSProviderOAuthPanel.vue b/frontend/src/components/VCSProviderOAuthPanel.vue
index a8d1a912b7..55fa1d97af 100644
--- a/frontend/src/components/VCSProviderOAuthPanel.vue
+++ b/frontend/src/components/VCSProviderOAuthPanel.vue
@@ -1,14 +1,14 @@
<template>
<div class="space-y-4">
<div class="textlabel">
- <template v-if="config.type == 'GITLAB_SELF_HOST'">
+ <template v-if="config.type == 'GITLAB'">
{{
$t(
"gitops.setting.add-git-provider.oauth-info.gitlab-register-oauth-application"
)
}}
</template>
- <template v-if="config.type == 'GITHUB_COM'">
+ <template v-if="config.type == 'GITHUB'">
{{
$t(
"gitops.setting.add-git-provider.oauth-info.github-register-oauth-application"
@@ -17,7 +17,7 @@
</template>
</div>
<ol class="textinfolabel space-y-2">
- <template v-if="config.type == 'GITLAB_SELF_HOST'">
+ <template v-if="config.type == 'GITLAB'">
<li>
1.
{{
@@ -103,7 +103,7 @@
}}
</li>
</template>
- <template v-if="config.type == 'GITHUB_COM'">
+ <template v-if="config.type == 'GITHUB'">
<li>
1.
{{
@@ -269,9 +269,9 @@ export default defineComponent({
});
const createAdminApplicationUrl = computed((): string => {
- if (props.config.type == "GITLAB_SELF_HOST") {
+ if (props.config.type == "GITLAB") {
return `${props.config.instanceUrl}/admin/applications/new`;
- } else if (props.config.type == "GITHUB_COM") {
+ } else if (props.config.type == "GITHUB") {
return `https://github.com/settings/applications/new`;
}
return "";
@@ -376,11 +376,11 @@ export default defineComponent({
};
const applicationIdErrorDescription = computed((): string => {
- if (props.config.type == "GITLAB_SELF_HOST") {
+ if (props.config.type == "GITLAB") {
return t(
"gitops.setting.add-git-provider.oauth-info.gitlab-application-id-error"
);
- } else if (props.config.type == "GITHUB_COM") {
+ } else if (props.config.type == "GITHUB") {
return t(
"gitops.setting.add-git-provider.oauth-info.github-application-id-error"
);
@@ -389,11 +389,11 @@ export default defineComponent({
});
const secretErrorDescription = computed((): string => {
- if (props.config.type == "GITLAB_SELF_HOST") {
+ if (props.config.type == "GITLAB") {
return t(
"gitops.setting.add-git-provider.oauth-info.gitlab-secret-error"
);
- } else if (props.config.type == "GITHUB_COM") {
+ } else if (props.config.type == "GITHUB") {
return t(
"gitops.setting.add-git-provider.oauth-info.github-secret-error"
);
diff --git a/frontend/src/components/VCSSetupWizard.vue b/frontend/src/components/VCSSetupWizard.vue
index e20ace4c81..2d6135d691 100644
--- a/frontend/src/components/VCSSetupWizard.vue
+++ b/frontend/src/components/VCSSetupWizard.vue
@@ -82,7 +82,7 @@ export default defineComponent({
const state = reactive<LocalState>({
config: {
- type: "GITLAB_SELF_HOST",
+ type: "GITLAB",
name: t("gitops.setting.add-git-provider.gitlab-self-host"),
instanceUrl: "",
applicationId: "",
@@ -102,10 +102,7 @@ export default defineComponent({
const eventListener = (event: Event) => {
const payload = (event as CustomEvent).detail as OAuthWindowEventPayload;
if (isEmpty(payload.error)) {
- if (
- state.config.type == "GITLAB_SELF_HOST" ||
- state.config.type == "GITHUB_COM"
- ) {
+ if (state.config.type == "GITLAB" || state.config.type == "GITHUB") {
useOAuthStore()
.exchangeVCSToken({
vcsType: state.config.type,
@@ -145,11 +142,11 @@ export default defineComponent({
});
const attentionText = computed((): string => {
- if (state.config.type == "GITLAB_SELF_HOST") {
+ if (state.config.type == "GITLAB") {
return t(
"gitops.setting.add-git-provider.gitlab-self-host-admin-requirement"
);
- } else if (state.config.type == "GITHUB_COM") {
+ } else if (state.config.type == "GITHUB") {
return t(
"gitops.setting.add-git-provider.github-com-admin-requirement"
);
@@ -172,7 +169,7 @@ export default defineComponent({
// 2. If step 1 succeeds, we will get a code, we use this code together with the secret to exchange for the access token. (see eventListener)
if (state.currentStep == OAUTH_INFO_STEP && newStep > oldStep) {
let authorizeUrl = `${state.config.instanceUrl}/oauth/authorize`;
- if (state.config.type == "GITHUB_COM") {
+ if (state.config.type == "GITHUB") {
authorizeUrl = `https://github.com/login/oauth/authorize`;
}
const newWindow = openWindowForOAuth(
@@ -193,7 +190,7 @@ export default defineComponent({
});
} else {
let description = "";
- if (state.config.type == "GITLAB_SELF_HOST") {
+ if (state.config.type == "GITLAB") {
// If application id mismatches, the OAuth workflow will stop early.
// So the only possibility to reach here is we have a matching application id, while
// we failed to exchange a token, and it's likely we are requesting with a wrong secret.
diff --git a/frontend/src/types/common.ts b/frontend/src/types/common.ts
index 2c0c439a55..44de62d587 100644
--- a/frontend/src/types/common.ts
+++ b/frontend/src/types/common.ts
@@ -377,7 +377,7 @@ const makeUnknown = (type: ResourceType) => {
const UNKNOWN_VCS: VCS = {
id: UNKNOWN_ID,
name: "",
- type: "GITLAB_SELF_HOST",
+ type: "GITLAB",
instanceUrl: "",
apiUrl: "",
applicationId: "",
@@ -732,7 +732,7 @@ const makeEmpty = (type: ResourceType) => {
const EMPTY_VCS: VCS = {
id: EMPTY_ID,
name: "",
- type: "GITLAB_SELF_HOST",
+ type: "GITLAB",
instanceUrl: "",
apiUrl: "",
applicationId: "",
diff --git a/frontend/src/types/oauth.ts b/frontend/src/types/oauth.ts
index 79f23f23f2..28b8f62177 100644
--- a/frontend/src/types/oauth.ts
+++ b/frontend/src/types/oauth.ts
@@ -43,7 +43,7 @@ export function openWindowForOAuth(
const stateQueryParameter = `${type}.${vcsType}-${applicationId}`;
sessionStorage.setItem(OAuthStateSessionKey, stateQueryParameter);
- if (vcsType == "GITHUB_COM") {
+ if (vcsType == "GITHUB") {
// GitHub OAuth App scopes: https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps
// We need the workflow scope to update GitHub action files.
return window.open(
@@ -54,7 +54,7 @@ export function openWindowForOAuth(
"location=yes,left=200,top=200,height=640,width=480,scrollbars=yes,status=yes"
);
}
- // GITLAB_SELF_HOST
+ // GITLAB
// GitLab OAuth App scopes: https://docs.gitlab.com/ee/integration/oauth_provider.html#authorized-applications
return window.open(
`${endpoint}?client_id=${applicationId}&redirect_uri=${encodeURIComponent(
diff --git a/frontend/src/types/repository.ts b/frontend/src/types/repository.ts
index f879a114ee..ede8f9245c 100644
--- a/frontend/src/types/repository.ts
+++ b/frontend/src/types/repository.ts
@@ -96,12 +96,12 @@ export function baseDirectoryWebUrl(
return repository.webUrl;
}
let url = "";
- if (repository.vcs.type == "GITLAB_SELF_HOST") {
+ if (repository.vcs.type == "GITLAB") {
url = `${repository.webUrl}/-/tree/${repository.branchFilter}`;
if (!isEmpty(repository.baseDirectory)) {
url += `/${repository.baseDirectory}`;
}
- } else if (repository.vcs.type == "GITHUB_COM") {
+ } else if (repository.vcs.type == "GITHUB") {
url = `${repository.webUrl}/tree/${repository.branchFilter}`;
if (!isEmpty(repository.baseDirectory)) {
url += `/${repository.baseDirectory}`;
diff --git a/frontend/src/types/sheet.ts b/frontend/src/types/sheet.ts
index 42b8fe00d6..a23bf7e787 100644
--- a/frontend/src/types/sheet.ts
+++ b/frontend/src/types/sheet.ts
@@ -11,7 +11,7 @@ import {
export type SheetVisibility = "PRIVATE" | "PROJECT" | "PUBLIC";
-export type SheetSource = "BYTEBASE" | "GITLAB_SELF_HOST" | "GITHUB_COM";
+export type SheetSource = "BYTEBASE" | "GITLAB" | "GITHUB";
export type SheetType = "SQL";
diff --git a/frontend/src/types/vcs.ts b/frontend/src/types/vcs.ts
index 6755906bdd..1c26f6ad23 100644
--- a/frontend/src/types/vcs.ts
+++ b/frontend/src/types/vcs.ts
@@ -1,6 +1,6 @@
import { VCSId } from "./id";
-export type VCSType = "GITLAB_SELF_HOST" | "GITHUB_COM";
+export type VCSType = "GITLAB" | "GITHUB";
export interface VCSConfig {
type: VCSType;
@@ -80,9 +80,9 @@ export function isValidVCSApplicationIdOrSecret(
vcsType: VCSType,
str: string
): boolean {
- if (vcsType == "GITLAB_SELF_HOST") {
+ if (vcsType == "GITLAB") {
return /^[a-zA-Z0-9_]{64}$/.test(str);
- } else if (vcsType == "GITHUB_COM") {
+ } else if (vcsType == "GITHUB") {
return /^[a-zA-Z0-9_]{20}$|^[a-zA-Z0-9_]{40}$/.test(str);
}
return false;
diff --git a/frontend/src/views/MigrationHistoryDetail.vue b/frontend/src/views/MigrationHistoryDetail.vue
index a12a196133..e8fb0b0729 100644
--- a/frontend/src/views/MigrationHistoryDetail.vue
+++ b/frontend/src/views/MigrationHistoryDetail.vue
@@ -366,10 +366,10 @@ export default defineComponent({
const vcsBranch = computed((): string => {
if (pushEvent.value) {
- if (pushEvent.value.vcsType == "GITLAB_SELF_HOST") {
+ if (pushEvent.value.vcsType == "GITLAB") {
const parts = pushEvent.value.ref.split("/");
return parts[parts.length - 1];
- } else if (pushEvent.value.vcsType == "GITHUB_COM") {
+ } else if (pushEvent.value.vcsType == "GITHUB") {
const parts = pushEvent.value.ref.split("/");
return parts[parts.length - 1];
}
@@ -379,9 +379,9 @@ export default defineComponent({
const vcsBranchUrl = computed((): string => {
if (pushEvent.value) {
- if (pushEvent.value.vcsType == "GITLAB_SELF_HOST") {
+ if (pushEvent.value.vcsType == "GITLAB") {
return `${pushEvent.value.repositoryUrl}/-/tree/${vcsBranch.value}`;
- } else if (pushEvent.value.vcsType == "GITHUB_COM") {
+ } else if (pushEvent.value.vcsType == "GITHUB") {
return `${pushEvent.value.repositoryUrl}/tree/${vcsBranch.value}`;
}
}
diff --git a/frontend/src/views/SettingWorkspaceVCSDetail.vue b/frontend/src/views/SettingWorkspaceVCSDetail.vue
index 945bbb268b..377f0763ba 100644
--- a/frontend/src/views/SettingWorkspaceVCSDetail.vue
+++ b/frontend/src/views/SettingWorkspaceVCSDetail.vue
@@ -2,7 +2,7 @@
<div class="mt-4 space-y-4">
<div class="flex justify-end">
<div
- v-if="vcs.type == 'GITLAB_SELF_HOST'"
+ v-if="vcs.type == 'GITLAB'"
class="flex flex-row items-center space-x-2"
>
<div class="textlabel whitespace-nowrap">
@@ -11,7 +11,7 @@
<img class="h-6 w-auto" src="../assets/gitlab-logo.svg" />
</div>
<div
- v-if="vcs.type == 'GITHUB_COM'"
+ v-if="vcs.type == 'GITHUB'"
class="flex flex-row items-center space-x-2"
>
<div class="textlabel whitespace-nowrap">GitHub.com</div>
@@ -56,13 +56,13 @@
{{ $t("common.application") }} ID
</label>
<p class="mt-1 textinfolabel">
- <template v-if="vcs.type == 'GITLAB_SELF_HOST'">
+ <template v-if="vcs.type == 'GITLAB'">
{{ $t("gitops.setting.git-provider.gitlab-application-id-label") }}
<a :href="adminApplicationUrl" target="_blank" class="normal-link">{{
$t("gitops.setting.git-provider.view-in-gitlab")
}}</a>
</template>
- <template v-if="vcs.type == 'GITHUB_COM'">
+ <template v-if="vcs.type == 'GITHUB'">
{{ $t("gitops.setting.git-provider.github-application-id-label") }}
</template>
</p>
@@ -78,10 +78,10 @@
<div>
<label for="secret" class="textlabel"> Secret </label>
<p class="mt-1 textinfolabel">
- <template v-if="vcs.type == 'GITLAB_SELF_HOST'">
+ <template v-if="vcs.type == 'GITLAB'">
{{ $t("gitops.setting.git-provider.secret-label-gitlab") }}
</template>
- <template v-if="vcs.type == 'GITHUB_COM'">
+ <template v-if="vcs.type == 'GITHUB'">
{{ $t("gitops.setting.git-provider.secret-label-github") }}
</template>
</p>
@@ -214,10 +214,7 @@ export default defineComponent({
const eventListener = (event: Event) => {
const payload = (event as CustomEvent).detail as OAuthWindowEventPayload;
if (isEmpty(payload.error)) {
- if (
- vcs.value.type == "GITLAB_SELF_HOST" ||
- vcs.value.type == "GITHUB_COM"
- ) {
+ if (vcs.value.type == "GITLAB" || vcs.value.type == "GITHUB") {
useOAuthStore()
.exchangeVCSTokenWithID({
code: payload.code,
@@ -244,7 +241,7 @@ export default defineComponent({
watchEffect(prepareRepositoryList);
const adminApplicationUrl = computed(() => {
- if (vcs.value.type == "GITLAB_SELF_HOST") {
+ if (vcs.value.type == "GITLAB") {
return `${vcs.value.instanceUrl}/admin/applications`;
}
return "";
@@ -268,7 +265,7 @@ export default defineComponent({
!isEmpty(state.secret)
) {
let authorizeUrl = `${vcs.value.instanceUrl}/oauth/authorize`;
- if (vcs.value.type == "GITHUB_COM") {
+ if (vcs.value.type == "GITHUB") {
authorizeUrl = `https://github.com/login/oauth/authorize`;
}
const newWindow = openWindowForOAuth(
@@ -307,10 +304,10 @@ export default defineComponent({
// So the only possibility to reach here is we have a matching application ID, while
// we failed to exchange a token, and it's likely we are requesting with a wrong secret.
let description = "";
- if (vcs.value.type == "GITLAB_SELF_HOST") {
+ if (vcs.value.type == "GITLAB") {
description =
"Please make sure Secret matches the one from your GitLab instance Application.";
- } else if (vcs.value.type == "GITHUB_COM") {
+ } else if (vcs.value.type == "GITHUB") {
description =
"Please make sure Client secret matches the one from your GitHub.com Application.";
}