Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Remove the —mode flag, instead use a demo bool flag
天舟5a3fb1e60195
diff --git a/.air.toml b/.air.tomlindex 93a3b8d0e9..9b093f9a83 100644--- a/.air.toml+++ b/.air.toml@@ -2,8 +2,8 @@ root = "."tmp_dir = ".air"[build]- bin = "./.air/bytebase --mode dev --port 8080"- cmd = "go build --tags \"debug sqlite_trace\" -o ./.air/bytebase ./bin/server/main.go"+ bin = "./.air/bytebase --port 8080"+ cmd = "go build --tags \"sqlite_trace\" -o ./.air/bytebase ./bin/server/main.go"delay = 1000exclude_dir = [".air", "vendor"]exclude_file = []diff --git a/.air_demo.toml b/.air_demo.tomlindex e3aebc1205..c070dba53d 100644--- a/.air_demo.toml+++ b/.air_demo.toml@@ -2,7 +2,7 @@ root = "."tmp_dir = ".air"[build]- bin = "./.air/bytebase --mode demo --port 8080"+ bin = "./.air/bytebase --demo --port 8080"cmd = "go build -o ./.air/bytebase ./bin/server/main.go"delay = 1000exclude_dir = [".air", "vendor"]diff --git a/Dockerfile b/Dockerfileindex fafd60ed26..b60593926a 100644--- a/Dockerfile+++ b/Dockerfile@@ -39,6 +39,7 @@ COPY --from=frontend /frontend-build/dist ./server/dist# -ldflags="-w -s" means omit DWARF symbol table and the symbol table and debug information# go-sqlite3 requires CGO_ENABLEDRUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build \+ --tags "release" \-ldflags="-w -s -X 'github.com/bytebase/bytebase/bin/server/cmd.version=${VERSION}' -X 'github.com/bytebase/bytebase/bin/server/cmd.goversion=${GO_VERSION}' -X 'github.com/bytebase/bytebase/bin/server/cmd.gitcommit=${GIT_COMMIT}' -X 'github.com/bytebase/bytebase/bin/server/cmd.buildtime=${BUILD_TIME}' -X 'github.com/bytebase/bytebase/bin/server/cmd.builduser=${BUILD_USER}'" \-o bytebase \./bin/server/main.go@@ -62,6 +63,6 @@ COPY --from=backend /backend-build/bytebase /usr/local/bin/# Directory to store the data, used as the mount pointRUN mkdir -p /var/opt/bytebase-CMD ["--mode", "release", "--host", "http://localhost", "--port", "8080", "--data", "/var/opt/bytebase"]+CMD ["--host", "http://localhost", "--port", "8080", "--data", "/var/opt/bytebase"]ENTRYPOINT ["bytebase"]\ No newline at end of filediff --git a/api/actuator.go b/api/actuator.goindex d84786ed49..bf2778d267 100644--- a/api/actuator.go+++ b/api/actuator.go@@ -2,7 +2,7 @@ package api// Actuator concept is similar to the Spring Boot Actuatortype ServerInfo struct {- Mode string `json:"mode"`+ Demo bool `json:"demo"`Host string `json:"host"`Port string `json:"port"`StartedTs int64 `json:"startedTs"`diff --git a/bin/server/cmd/profile_dev.go b/bin/server/cmd/profile_dev.gonew file mode 100644index 0000000000..ef3c18d3b3--- /dev/null+++ b/bin/server/cmd/profile_dev.go@@ -0,0 +1,22 @@+// +build !release++package cmd++import (+ "fmt"++ "go.uber.org/zap"+)++func activeProfile(dataDir string, isDemo bool) profile {+ dsn := fmt.Sprintf("file:%s/bytebase_dev.db", dataDir)+ if isDemo {+ dsn = fmt.Sprintf("file:%s/bytebase_demo.db", dataDir)+ }+ return profile{+ demo: isDemo,+ logConfig: zap.NewDevelopmentConfig(),+ dsn: dsn,+ seedDir: "seed/test",+ }+}diff --git a/bin/server/cmd/profile_release.go b/bin/server/cmd/profile_release.gonew file mode 100644index 0000000000..1f7a213773--- /dev/null+++ b/bin/server/cmd/profile_release.go@@ -0,0 +1,24 @@+// +build release++package cmd++import (+ "fmt"++ "go.uber.org/zap"+)++func activeProfile(dataDir string, isDemo bool) profile {+ dsn := fmt.Sprintf("file:%s/bytebase.db", dataDir)+ seedDir := "seed/release"+ if isDemo {+ dsn = fmt.Sprintf("file:%s/bytebase_demo.db", dataDir)+ seedDir = "seed/test"+ }+ return profile{+ demo: isDemo,+ logConfig: zap.NewDevelopmentConfig(),+ dsn: dsn,+ seedDir: seedDir,+ }+}diff --git a/bin/server/cmd/root.go b/bin/server/cmd/root.goindex 3b7cf245cb..3edff7c9b0 100644--- a/bin/server/cmd/root.go+++ b/bin/server/cmd/root.go@@ -41,12 +41,12 @@ ________________________________________________________________________________var (// Used for flags.- mode stringhost stringport intdataDir stringsecretFile stringsecret string+ demo boolrootCmd = &cobra.Command{Use: "bytebase",@@ -68,20 +68,21 @@ func Execute() error {}func init() {- rootCmd.PersistentFlags().StringVar(&mode, "mode", "release", "mode which Bytebase is running under. release | dev | demo")rootCmd.PersistentFlags().StringVar(&host, "host", "http://localhost", "host where Bytebase is running. e.g. https://bytebase.example.com")rootCmd.PersistentFlags().IntVar(&port, "port", 8080, "port where Bytebase is running e.g. 8080")rootCmd.PersistentFlags().StringVar(&dataDir, "data", "./data", "directory where Bytebase stores data.")rootCmd.PersistentFlags().StringVar(&secretFile, "secret", "./data/secret", "file path storing the secret to sign the JWT for authentication. If file does not exist, Bytebase will generate a 32 byte random string consisting of numbers and letters.")+ rootCmd.PersistentFlags().BoolVar(&demo, "demo", false, "whether to run in demo mode. Demo mode uses demo data and is read-only.")}// -----------------------------------Command Line Config END--------------------------------------// -----------------------------------Main Entry Point---------------------------------------------type profile struct {- mode string+ demo boollogConfig zap.Configdsn string+ seedDir string}type main struct {@@ -95,9 +96,6 @@ type main struct {}func preStart() error {- if mode != "release" && mode != "dev" && mode != "demo" {- return fmt.Errorf("invalid --mode %s, expect \"release\" | \"dev\" | \"demo\"", mode)- }// Trim trailing / in case user suppliesdir, err := filepath.Abs(strings.TrimRight(dataDir, "/"))if err != nil {@@ -164,30 +162,14 @@ func start() {}func newMain() *main {- var activeProfile = map[string]profile{- "dev": {- mode: "dev",- logConfig: zap.NewDevelopmentConfig(),- dsn: fmt.Sprintf("file:%s/bytebase_dev.db", dataDir),- },- "release": {- mode: "release",- logConfig: zap.NewProductionConfig(),- dsn: fmt.Sprintf("file:%s/bytebase.db", dataDir),- },- "demo": {- mode: "demo",- logConfig: zap.NewProductionConfig(),- dsn: fmt.Sprintf("file:%s/bytebase_demo.db", dataDir),- },- }[mode]+ activeProfile := activeProfile(dataDir, demo)fmt.Println("-----Config BEGIN-----")- fmt.Printf("mode=%s\n", activeProfile.mode)fmt.Printf("host=%s\n", host)fmt.Printf("port=%d\n", port)fmt.Printf("data=%s\n", activeProfile.dsn)fmt.Printf("secret=%s\n", secretFile)+ fmt.Printf("demo=%t\n", demo)fmt.Println("-----Config END-------")// Always set encoding to "console" for now since we do not redirect to file.@@ -205,14 +187,14 @@ func newMain() *main {}func (m *main) Run() error {- db := store.NewDB(m.l, m.profile.dsn, m.profile.mode)+ db := store.NewDB(m.l, m.profile.dsn, m.profile.seedDir)if err := db.Open(); err != nil {return fmt.Errorf("cannot open db: %w", err)}m.db = db- server := server.NewServer(m.l, m.profile.mode, host, port, secret)+ server := server.NewServer(m.l, host, port, secret, demo)server.PrincipalService = store.NewPrincipalService(m.l, db)server.MemberService = store.NewMemberService(m.l, db)server.ProjectService = store.NewProjectService(m.l, db)diff --git a/build.sh b/build.shindex a944d0f557..c22a8269de 100755--- a/build.sh+++ b/build.sh@@ -55,7 +55,7 @@ flags="-X 'github.com/bytebase/bytebase/bin/server/cmd.version=${VERSION}'-X 'github.com/bytebase/bytebase/bin/server/cmd.builduser=$(id -u -n)'"# -ldflags="-w -s" means omit DWARF symbol table and the symbol table and debug information-go build -ldflags "-w -s $flags" -o ${OUTPUT_BINARY} ./bin/server/main.go+go build --tags "release" -ldflags "-w -s $flags" -o ${OUTPUT_BINARY} ./bin/server/main.goecho "Completed building bytebase backend."diff --git a/build_docker.sh b/build_docker.shindex 902da6f0e9..7e6e0d7c54 100755--- a/build_docker.sh+++ b/build_docker.sh@@ -29,5 +29,5 @@ echo "$ docker run --init --name bytebase --restart always --publish 8080:8080 -echo ""echo "Command to start Bytebase in demo mode on http://example.com"echo ""-echo "$ docker run --init --name bytebase --restart always --publish 80:8080 --volume ~/.bytebase/data:/var/opt/bytebase bytebase/bytebase --mode demo --host http://example.com"+echo "$ docker run --init --name bytebase --restart always --publish 80:8080 --volume ~/.bytebase/data:/var/opt/bytebase bytebase/bytebase --demo --host http://example.com"echo ""\ No newline at end of filediff --git a/frontend/.env.demo b/frontend/.env.demodeleted file mode 100644index 995fca4af2..0000000000--- a/frontend/.env.demo+++ /dev/null@@ -1 +0,0 @@-NODE_ENV=production\ No newline at end of filediff --git a/frontend/package.json b/frontend/package.jsonindex caa3515e40..53cf0c9498 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -4,9 +4,7 @@"license": "Apache-2.0","scripts": {"dev": "vite --mode dev",- "demo": "vite --mode demo","release": "vite build --mode release --outDir=../server/dist --emptyOutDir",- "release-demo": "vite build --mode demo --outDir=../server/dist --emptyOutDir","release-docker": "vite build --mode release"},"dependencies": {diff --git a/frontend/src/store/modules/actuator.ts b/frontend/src/store/modules/actuator.tsindex 0f5f5a4a84..9beb03f602 100644--- a/frontend/src/store/modules/actuator.ts+++ b/frontend/src/store/modules/actuator.ts@@ -10,7 +10,7 @@ const getters = {return state.serverInfo;},isDemo: (state: ActuatorState) => (): boolean => {- return state.serverInfo?.mode == "demo";+ return state.serverInfo?.demo || false;},};diff --git a/frontend/src/types/actuator.ts b/frontend/src/types/actuator.tsindex 5f5db20461..577c44a7c1 100644--- a/frontend/src/types/actuator.ts+++ b/frontend/src/types/actuator.ts@@ -1,5 +1,5 @@export type ServerInfo = {- mode: string;+ demo: boolean;host: string;port: string;startedTs: number;diff --git a/server/actuator.go b/server/actuator.goindex ff13d6c6c7..d203b96e55 100644--- a/server/actuator.go+++ b/server/actuator.go@@ -11,7 +11,7 @@ import (func (s *Server) registerActuatorRoutes(g *echo.Group) {g.GET("/actuator/info", func(c echo.Context) error {serverInfo := api.ServerInfo{- Mode: s.mode,+ Demo: s.demo,Host: s.host,Port: strconv.Itoa(s.port),StartedTs: s.startedTs,diff --git a/server/server.go b/server/server.goindex b15dd2d822..4a4a1f22a9 100644--- a/server/server.go+++ b/server/server.go@@ -44,11 +44,11 @@ type Server struct {e *echo.Echol *zap.Logger- mode stringhost stringport intstartedTs int64secret string+ demo bool}//go:embed dist@@ -78,7 +78,7 @@ func getFileSystem() http.FileSystem {return http.FS(fsys)}-func NewServer(logger *zap.Logger, mode, host string, port int, secret string) *Server {+func NewServer(logger *zap.Logger, host string, port int, secret string, demo bool) *Server {e := echo.New()e.HideBanner = truee.HidePort = true@@ -95,11 +95,11 @@ func NewServer(logger *zap.Logger, mode, host string, port int, secret string) *s := &Server{l: logger,e: e,- mode: mode,host: host,port: port,startedTs: time.Now().Unix(),secret: secret,+ demo: demo,}scheduler := NewTaskScheduler(logger, s)diff --git a/store/seed/README.md b/store/seed/README.mdindex 874c6f6994..1ab513c51c 100644--- a/store/seed/README.md+++ b/store/seed/README.md@@ -1,4 +1,4 @@-This folder contains the seed data. Each folder contains seed files for the corresponding mode+This folder contains the seed data. The release seed data is loaded when building with "release" tag and is NOT running with --demo. Otherwise, the test seed data is loaded.Each file represents the data for a particular table. The file name is something like 00XX, reasons for doing this:diff --git a/store/seed/dev/0001_principal.sql b/store/seed/dev/0001_principal.sqldeleted file mode 100644index 4d3eea3935..0000000000--- a/store/seed/dev/0001_principal.sql+++ /dev/null@@ -1,85 +0,0 @@--- End user id starts at 101, we reserve the range between 1 ~ 100 for internal use.--- Setting the id explicitly changes the next id value to be +1--- 101-INSERT INTO- principal (- creator_id,- updater_id,- `type`,- name,- email,- password_hash- )-VALUES- (- 1,- 1,- 'END_USER',- 'Demo Owner',- '[email protected]',- -- 1024- '$2a$10$/65QFlHOmDzXshEMt/qYuunbJrXtRLcaYDcRODbyOPa/9/N0N8Zc2'- );---- 102-INSERT INTO- principal (- creator_id,- updater_id,- `type`,- name,- email,- password_hash- )-VALUES- (- 1,- 1,- 'END_USER',- 'Jerry DBA',- '[email protected]',- -- 2048- '$2a$10$Q2NJib9bRvDkap1N1RDP2O3HyxjCldwfvGoxAzZL5gbbBgKAFD4cq'- );---- 103-INSERT INTO- principal (- creator_id,- updater_id,- `type`,- name,- email,- password_hash- )-VALUES- (- 1,- 1,- 'END_USER',- 'Tom Dev',- '[email protected]',- -- 4096- '$2a$10$X5bvIWk4BKhEaZqlNLGjgOUB09i97olKBfjTQT49zMtNGnhoy6GIW'- );---- 104-INSERT INTO- principal (- creator_id,- updater_id,- `type`,- name,- email,- password_hash- )-VALUES- (- 1,- 1,- 'END_USER',- 'Jane Dev',- '[email protected]',- -- 8192- '$2a$10$2QTgsuKDTGYe68lpeqRqouw1dQTRhssrYSnwQVzQUctQvhnVIccRa'- );\ No newline at end of filediff --git a/store/seed/dev/0010_workspace.sql b/store/seed/dev/0010_workspace.sqldeleted file mode 100644index e2c27b7230..0000000000--- a/store/seed/dev/0010_workspace.sql+++ /dev/null@@ -1 +0,0 @@--- 0010 is reserved for workspace, but is not implemented yet.\ No newline at end of filediff --git a/store/seed/dev/0020_member.sql b/store/seed/dev/0020_member.sqldeleted file mode 100644index 697e4842ca..0000000000--- a/store/seed/dev/0020_member.sql+++ /dev/null@@ -1,47 +0,0 @@-INSERT INTO- member (- id,- creator_id,- updater_id,- `status`,- role,- principal_id- )-VALUES- (2001, 101, 101, 'ACTIVE', 'OWNER', 101);--INSERT INTO- member (- id,- creator_id,- updater_id,- `status`,- role,- principal_id- )-VALUES- (2002, 101, 101, 'ACTIVE', 'DBA', 102);--INSERT INTO- member (- id,- creator_id,- updater_id,- `status`,- role,- principal_id- )-VALUES- (2003, 101, 101, 'ACTIVE', 'DEVELOPER', 103);--INSERT INTO- member (- id,- creator_id,- updater_id,- `status`,- role,- principal_id- )-VALUES- (2004, 101, 101, 'ACTIVE', 'DEVELOPER', 104);\ No newline at end of filediff --git a/store/seed/dev/0030_project.sql b/store/seed/dev/0030_project.sqldeleted file mode 100644index 8cfe0bed7a..0000000000--- a/store/seed/dev/0030_project.sql+++ /dev/null@@ -1,96 +0,0 @@-INSERT INTO- project (- id,- creator_id,- updater_id,- name,- `key`,- workflow_type- )-VALUES- (- 3001,- 101,- 101,- 'project 1',- 'PRJ1',- 'VCS'- );--INSERT INTO- project (- id,- creator_id,- updater_id,- name,- `key`,- workflow_type- )-VALUES- (- 3002,- 101,- 101,- 'project 2',- 'PRJ2',- 'UI'- );--INSERT INTO- project (- id,- creator_id,- updater_id,- name,- `key`,- workflow_type- )-VALUES- (- 3003,- 101,- 101,- 'project 3',- 'PRJ3',- 'UI'- );--INSERT INTO- project (- id,- creator_id,- updater_id,- name,- `key`,- workflow_type- )-VALUES- (- 3004,- 101,- 101,- 'project 4',- 'PRJ4',- 'UI'- );--INSERT INTO- project (- id,- row_status,- creator_id,- updater_id,- name,- `key`,- workflow_type- )-VALUES- (- 3005,- 'ARCHIVED',- 101,- 101,- 'project 5',- 'PRJ5',- 'UI'- );\ No newline at end of filediff --git a/store/seed/dev/0040_project_member.sql b/store/seed/dev/0040_project_member.sqldeleted file mode 100644index d62835f746..0000000000--- a/store/seed/dev/0040_project_member.sql+++ /dev/null@@ -1,213 +0,0 @@--- Project 3001 membership-INSERT INTO- project_member (- id,- creator_id,- updater_id,- project_id,- `role`,- principal_id- )-VALUES- (- 4001,- 101,- 101,- 3001,- 'OWNER',- 102- );--INSERT INTO- project_member (- id,- creator_id,- updater_id,- project_id,- `role`,- principal_id- )-VALUES- (- 4002,- 101,- 101,- 3001,- 'DEVELOPER',- 101- );--INSERT INTO- project_member (- id,- creator_id,- updater_id,- project_id,- `role`,- principal_id- )-VALUES- (- 4003,- 101,- 101,- 3001,- 'DEVELOPER',- 103- );---- Project 3002 membership-INSERT INTO- project_member (- id,- creator_id,- updater_id,- project_id,- `role`,- principal_id- )-VALUES- (- 4004,- 101,- 101,- 3002,- 'OWNER',- 103- );--INSERT INTO- project_member (- id,- creator_id,- updater_id,- project_id,- `role`,- principal_id- )-VALUES- (- 4005,- 101,- 101,- 3002,- 'DEVELOPER',- 102- );---- Project 3003 membership-INSERT INTO- project_member (- id,- creator_id,- updater_id,- project_id,- `role`,- principal_id- )-VALUES- (- 4006,- 101,- 101,- 3003,- 'OWNER',- 102- );--INSERT INTO- project_member (- id,- creator_id,- updater_id,- project_id,- `role`,- principal_id- )-VALUES- (- 4007,- 101,- 101,- 3003,- 'DEVELOPER',- 101- );---- Project 3004 membership-INSERT INTO- project_member (- id,- creator_id,- updater_id,- project_id,- `role`,- principal_id- )-VALUES- (- 4008,- 101,- 101,- 3004,- 'OWNER',- 102- );--INSERT INTO- project_member (- id,- creator_id,- updater_id,- project_id,- `role`,- principal_id- )-VALUES- (- 4009,- 101,- 101,- 3004,- 'DEVELOPER',- 101- );---- Project 3005 membership-INSERT INTO- project_member (- id,- creator_id,- updater_id,- project_id,- `role`,- principal_id- )-VALUES- (- 4010,- 101,- 101,- 3005,- 'OWNER',- 101- );--INSERT INTO- project_member (- id,- creator_id,- updater_id,- project_id,- `role`,- principal_id- )-VALUES- (- 4011,- 101,- 101,- 3005,- 'DEVELOPER',- 103- );\ No newline at end of filediff --git a/store/seed/dev/0050_environment.sql b/store/seed/dev/0050_environment.sqldeleted file mode 100644index f9d7a609dc..0000000000--- a/store/seed/dev/0050_environment.sql+++ /dev/null@@ -1,86 +0,0 @@-INSERT INTO- environment (- id,- creator_id,- updater_id,- name,- `order`- )-VALUES- (- 5001,- 101,- 101,- 'Sandbox A',- 0- );--INSERT INTO- environment (- id,- creator_id,- updater_id,- name,- `order`- )-VALUES- (- 5002,- 101,- 101,- 'Integration',- 1- );--INSERT INTO- environment (- id,- creator_id,- updater_id,- name,- `order`- )-VALUES- (- 5003,- 101,- 101,- 'Staging',- 2- );--INSERT INTO- environment (- id,- creator_id,- updater_id,- name,- `order`- )-VALUES- (- 5004,- 101,- 101,- 'Prod',- 3- );--INSERT INTO- environment (- id,- row_status,- creator_id,- updater_id,- name,- `order`- )-VALUES- (- 5005,- 'ARCHIVED',- 101,- 101,- 'Archived Env 1',- 4- );\ No newline at end of filediff --git a/store/seed/dev/0060_instance.sql b/store/seed/dev/0060_instance.sqldeleted file mode 100644index 1d02f15000..0000000000--- a/store/seed/dev/0060_instance.sql+++ /dev/null@@ -1,124 +0,0 @@-INSERT INTO- instance (- id,- creator_id,- updater_id,- environment_id,- name,- `engine`,- external_link,- host,- port- )-VALUES- (- 6001,- 101,- 101,- 5001,- 'MySQL sandbox',- 'MYSQL',- 'localhost',- '127.0.0.1',- '33060'- );--INSERT INTO- instance (- id,- creator_id,- updater_id,- environment_id,- name,- `engine`,- external_link,- host,- port- )-VALUES- (- 6002,- 101,- 101,- 5002,- 'MySQL integration',- 'MYSQL',- 'localhost',- '127.0.0.1',- '33060'- );--INSERT INTO- instance (- id,- creator_id,- updater_id,- environment_id,- name,- `engine`,- external_link,- host,- port- )-VALUES- (- 6003,- 101,- 101,- 5003,- 'MySQL staging',- 'MYSQL',- 'localhost',- '127.0.0.1',- '33060'- );--INSERT INTO- instance (- id,- creator_id,- updater_id,- environment_id,- name,- `engine`,- external_link,- host,- port- )-VALUES- (- 6004,- 101,- 101,- 5004,- 'MySQL prod',- 'MYSQL',- 'localhost',- '127.0.0.1',- '33060'- );--INSERT INTO- instance (- id,- creator_id,- updater_id,- environment_id,- name,- `engine`,- external_link,- host,- port- )-VALUES- (- 6005,- 101,- 101,- 5004,- 'AWS RDS prod',- 'MYSQL',- 'aws.com',- 'rds.com',- '5678'- );\ No newline at end of filediff --git a/store/seed/dev/0070_db.sql b/store/seed/dev/0070_db.sqldeleted file mode 100644index 0d1a60b2c6..0000000000--- a/store/seed/dev/0070_db.sql+++ /dev/null@@ -1,526 +0,0 @@--- Database for sandbox environment instance 6001-INSERT INTO- db (- id,- creator_id,- updater_id,- instance_id,- project_id,- name,- character_set,- `collation`,- sync_status,- last_successful_sync_ts,- fingerprint- )-VALUES- (- 7001,- 101,- 101,- 6001,- 1,- '*',- 'utf8mb4',- 'utf8mb4_0900_ai_ci',- 'OK',- 0,- ''- );--INSERT INTO- db (- id,- creator_id,- updater_id,- instance_id,- project_id,- name,- character_set,- `collation`,- sync_status,- last_successful_sync_ts,- fingerprint- )-VALUES- (- 7002,- 101,- 101,- 6001,- 3001,- 'sandboxdb1',- 'utf8mb4',- 'utf8mb4_0900_ai_ci',- 'OK',- 0,- ''- );--INSERT INTO- db (- id,- creator_id,- updater_id,- instance_id,- project_id,- name,- character_set,- `collation`,- sync_status,- last_successful_sync_ts,- fingerprint- )-VALUES- (- 7003,- 101,- 101,- 6001,- 3002,- 'sandboxdb2',- 'utf8mb4',- 'utf8mb4_0900_ai_ci',- 'OK',- 0,- ''- );--INSERT INTO- db (- id,- creator_id,- updater_id,- instance_id,- project_id,- name,- character_set,- `collation`,- sync_status,- last_successful_sync_ts,- fingerprint- )-VALUES- (- 7004,- 101,- 101,- 6001,- 3003,- 'sandboxdb3',- 'utf8mb4',- 'utf8mb4_0900_ai_ci',- 'OK',- 0,- ''- );---- Database for integration environment instance 6002-INSERT INTO- db (- id,- creator_id,- updater_id,- instance_id,- project_id,- name,- character_set,- `collation`,- sync_status,- last_successful_sync_ts,- fingerprint- )-VALUES- (- 7005,- 101,- 101,- 6002,- 1,- '*',- 'utf8mb4',- 'utf8mb4_0900_ai_ci',- 'OK',- 0,- ''- );--INSERT INTO- db (- id,- creator_id,- updater_id,- instance_id,- project_id,- name,- character_set,- `collation`,- sync_status,- last_successful_sync_ts,- fingerprint- )-VALUES- (- 7006,- 101,- 101,- 6002,- 3001,- 'integrationdb1',- 'utf8mb4',- 'utf8mb4_0900_ai_ci',- 'OK',- 0,- ''- );--INSERT INTO- db (- id,- creator_id,- updater_id,- instance_id,- project_id,- name,- character_set,- `collation`,- sync_status,- last_successful_sync_ts,- fingerprint- )-VALUES- (- 7007,- 101,- 101,- 6002,- 3002,- 'integrationdb2',- 'utf8mb4',- 'utf8mb4_0900_ai_ci',- 'OK',- 0,- ''- );--INSERT INTO- db (- id,- creator_id,- updater_id,- instance_id,- project_id,- name,- character_set,- `collation`,- sync_status,- last_successful_sync_ts,- fingerprint- )-VALUES- (- 7008,- 101,- 101,- 6002,- 3003,- 'integrationdb3',- 'utf8mb4',- 'utf8mb4_0900_ai_ci',- 'OK',- 0,- ''- );---- Database for staging environment instance 6003-INSERT INTO- db (- id,- creator_id,- updater_id,- instance_id,- project_id,- name,- character_set,- `collation`,- sync_status,- last_successful_sync_ts,- fingerprint- )-VALUES- (- 7009,- 101,- 101,- 6003,- 1,- '*',- 'utf8mb4',- 'utf8mb4_0900_ai_ci',- 'OK',- 0,- ''- );--INSERT INTO- db (- id,- creator_id,- updater_id,- instance_id,- project_id,- name,- character_set,- `collation`,- sync_status,- last_successful_sync_ts,- fingerprint- )-VALUES- (- 7010,- 101,- 101,- 6003,- 3001,- 'stagingdb1',- 'utf8mb4',- 'utf8mb4_0900_ai_ci',- 'OK',- 0,- ''- );--INSERT INTO- db (- id,- creator_id,- updater_id,- instance_id,- project_id,- name,- character_set,- `collation`,- sync_status,- last_successful_sync_ts,- fingerprint- )-VALUES- (- 7011,- 101,- 101,- 6003,- 3002,- 'stagingdb2',- 'utf8mb4',- 'utf8mb4_0900_ai_ci',- 'OK',- 0,- ''- );--INSERT INTO- db (- id,- creator_id,- updater_id,- instance_id,- project_id,- name,- character_set,- `collation`,- sync_status,- last_successful_sync_ts,- fingerprint- )-VALUES- (- 7012,- 101,- 101,- 6003,- 3003,- 'stagingdb3',- 'utf8mb4',- 'utf8mb4_0900_ai_ci',- 'OK',- 0,- ''- );---- Database for prod environment instance 6004-INSERT INTO- db (- id,- creator_id,- updater_id,- instance_id,- project_id,- name,- character_set,- `collation`,- sync_status,- last_successful_sync_ts,- fingerprint- )-VALUES- (- 7013,- 101,- 101,- 6004,- 1,- '*',- 'utf8mb4',- 'utf8mb4_0900_ai_ci',- 'OK',- 0,- ''- );--INSERT INTO- db (- id,- creator_id,- updater_id,- instance_id,- project_id,- name,- character_set,- `collation`,- sync_status,- last_successful_sync_ts,- fingerprint- )-VALUES- (- 7014,- 101,- 101,- 6004,- 3001,- 'proddb1',- 'utf8mb4',- 'utf8mb4_0900_ai_ci',- 'OK',- 0,- ''- );--INSERT INTO- db (- id,- creator_id,- updater_id,- instance_id,- project_id,- name,- character_set,- `collation`,- sync_status,- last_successful_sync_ts,- fingerprint- )-VALUES- (- 7015,- 101,- 101,- 6004,- 3002,- 'proddb2',- 'utf8mb4',- 'utf8mb4_0900_ai_ci',- 'OK',- 0,- ''- );--INSERT INTO- db (- id,- creator_id,- updater_id,- instance_id,- project_id,- name,- character_set,- `collation`,- sync_status,- last_successful_sync_ts,- fingerprint- )-VALUES- (- 7016,- 101,- 101,- 6004,- 3002,- 'proddb21',- 'utf8mb4',- 'utf8mb4_0900_ai_ci',- 'OK',- 0,- ''- );--INSERT INTO- db (- id,- creator_id,- updater_id,- instance_id,- project_id,- name,- character_set,- `collation`,- sync_status,- last_successful_sync_ts,- fingerprint- )-VALUES- (- 7017,- 101,- 101,- 6004,- 3003,- 'proddb3',- 'utf8mb4',- 'utf8mb4_0900_ai_ci',- 'OK',- 0,- ''- );---- Database for prod environment instance 6005-INSERT INTO- db (- id,- creator_id,- updater_id,- instance_id,- project_id,- name,- character_set,- `collation`,- sync_status,- last_successful_sync_ts,- fingerprint- )-VALUES- (- 7018,- 101,- 101,- 6005,- 1,- '*',- 'utf8mb4',- 'utf8mb4_0900_ai_ci',- 'OK',- 0,- ''- );\ No newline at end of filediff --git a/store/seed/dev/0071_tbl.sql b/store/seed/dev/0071_tbl.sqldeleted file mode 100644index 2bacb747fd..0000000000--- a/store/seed/dev/0071_tbl.sql+++ /dev/null@@ -1,2 +0,0 @@--- tbl is populated via schema sync, so no seed data here.--- Creating this file just to reduce confusion in case people may wonder whether we miss the file.\ No newline at end of filediff --git a/store/seed/dev/0080_data_source.sql b/store/seed/dev/0080_data_source.sqldeleted file mode 100644index 4d3c7564e9..0000000000--- a/store/seed/dev/0080_data_source.sql+++ /dev/null@@ -1,124 +0,0 @@-INSERT INTO- data_source (- id,- creator_id,- updater_id,- instance_id,- database_id,- name,- TYPE,- username,- PASSWORD- )-VALUES- (- 8001,- 1,- 1,- 6001,- 7001,- 'Admin data source',- 'ADMIN',- 'root',- 'root'- );--INSERT INTO- data_source (- id,- creator_id,- updater_id,- instance_id,- database_id,- name,- TYPE,- username,- PASSWORD- )-VALUES- (- 8002,- 1,- 1,- 6002,- 7005,- 'Admin data source',- 'ADMIN',- 'root',- 'root'- );--INSERT INTO- data_source (- id,- creator_id,- updater_id,- instance_id,- database_id,- name,- TYPE,- username,- PASSWORD- )-VALUES- (- 8003,- 1,- 1,- 6003,- 7009,- 'Admin data source',- 'ADMIN',- 'root',- 'root'- );--INSERT INTO- data_source (- id,- creator_id,- updater_id,- instance_id,- database_id,- name,- TYPE,- username,- PASSWORD- )-VALUES- (- 8004,- 1,- 1,- 6004,- 7013,- 'Admin data source',- 'ADMIN',- 'root',- 'root'- );--INSERT INTO- data_source (- id,- creator_id,- updater_id,- instance_id,- database_id,- name,- TYPE,- username,- PASSWORD- )-VALUES- (- 8005,- 1,- 1,- 6005,- 7017,- 'Admin data source',- 'ADMIN',- 'admin5',- 'adminpwd5'- );\ No newline at end of filediff --git a/store/seed/dev/0090_pipeline.sql b/store/seed/dev/0090_pipeline.sqldeleted file mode 100644index 6a60276155..0000000000--- a/store/seed/dev/0090_pipeline.sql+++ /dev/null@@ -1,71 +0,0 @@--- A single stage, single task "hello world"-INSERT INTO- pipeline (- id,- creator_id,- updater_id,- name,- `status`- )-VALUES- (- 9001,- 101,- 101,- 'Pipeline - Hello world',- 'OPEN'- );---- A multi stage, each containing a single add column task-INSERT INTO- pipeline (- id,- creator_id,- updater_id,- name,- `status`- )-VALUES- (- 9002,- 103,- 103,- 'Pipeline - Add column ''location'' to table ''warehouse''',- 'OPEN'- );---- A two stage, each containing a single create table task, the 1st task has a failed task run-INSERT INTO- pipeline (- id,- creator_id,- updater_id,- name,- `status`- )-VALUES- (- 9003,- 103,- 103,- 'Pipeline - Create table ''tbl1''',- 'OPEN'- );---- A pipeline simulating webhook push event-INSERT INTO- pipeline (- id,- creator_id,- updater_id,- name,- `status`- )-VALUES- (- 9004,- 1,- 1,- 'Pipeline - Create todo table to staging db1',- 'OPEN'- );\ No newline at end of filediff --git a/store/seed/dev/0100_stage.sql b/store/seed/dev/0100_stage.sqldeleted file mode 100644index 45a36c8e34..0000000000--- a/store/seed/dev/0100_stage.sql+++ /dev/null@@ -1,155 +0,0 @@--- Stage for Pipeline 9001 "Hello world"-INSERT INTO- stage (- id,- creator_id,- updater_id,- pipeline_id,- environment_id,- name- )-VALUES- (- 10001,- 101,- 101,- 9001,- 5004,- 'Prod'- );---- Stage for Pipeline 9002 add column-INSERT INTO- stage (- id,- creator_id,- updater_id,- pipeline_id,- environment_id,- name- )-VALUES- (- 10002,- 103,- 103,- 9002,- 5001,- 'Sandbox A'- );--INSERT INTO- stage (- id,- creator_id,- updater_id,- pipeline_id,- environment_id,- name- )-VALUES- (- 10003,- 103,- 103,- 9002,- 5002,- 'Integration'- );--INSERT INTO- stage (- id,- creator_id,- updater_id,- pipeline_id,- environment_id,- name- )-VALUES- (- 10004,- 103,- 103,- 9002,- 5003,- 'Staging'- );--INSERT INTO- stage (- id,- creator_id,- updater_id,- pipeline_id,- environment_id,- name- )-VALUES- (- 10005,- 103,- 103,- 9002,- 5004,- 'Prod'- );---- Stage for Pipeline 9003 create table-INSERT INTO- stage (- id,- creator_id,- updater_id,- pipeline_id,- environment_id,- name- )-VALUES- (- 10006,- 103,- 103,- 9003,- 5001,- 'Sandbox A'- );--INSERT INTO- stage (- id,- creator_id,- updater_id,- pipeline_id,- environment_id,- name- )-VALUES- (- 10007,- 103,- 103,- 9003,- 5002,- 'Integration'- );---- Stage for Pipeline 9004 simulating webhook push event-INSERT INTO- stage (- id,- creator_id,- updater_id,- pipeline_id,- environment_id,- name- )-VALUES- (- 10008,- 1,- 1,- 9004,- 5003,- 'Staging'- );\ No newline at end of filediff --git a/store/seed/dev/0110_task.sql b/store/seed/dev/0110_task.sqldeleted file mode 100644index 6467f620c6..0000000000--- a/store/seed/dev/0110_task.sql+++ /dev/null@@ -1,241 +0,0 @@--- Task for Pipeline 9001 "Hello world", Stage 10001 "Prod" to update database 7008 "proddb1"-INSERT INTO- task (- id,- creator_id,- updater_id,- pipeline_id,- stage_id,- instance_id,- database_id,- name,- `type`,- `status`,- payload- )-VALUES- (- 1101,- 101,- 101,- 9001,- 10001,- 6004,- 7014,- 'Welcome',- 'bb.task.general',- 'PENDING_APPROVAL',- '{"statement":"SELECT ''Welcome Tech Lead, DBA, Developer'';"}'- );---- Task for Pipeline 9002 add column--- Task for stage 10002 "Sandbox A" to update database 7002 'sandboxdb1'-INSERT INTO- task (- id,- creator_id,- updater_id,- pipeline_id,- stage_id,- instance_id,- database_id,- name,- `type`,- `status`,- payload- )-VALUES- (- 1102,- 103,- 103,- 9002,- 10002,- 6001,- 7002,- 'Update sandboxdb1',- 'bb.task.database.schema.update',- 'PENDING',- '{"statement":"ALTER TABLE sandboxdb1.warehouse ADD COLUMN location VARCHAR(255);", "rollbackStatement":"ALTER TABLE sandboxdb1.warehouse DROP COLUMN location;"}'- );---- Task for stage 10003 "Integration" to update database 7006 'integrationdb1'-INSERT INTO- task (- id,- creator_id,- updater_id,- pipeline_id,- stage_id,- instance_id,- database_id,- name,- `type`,- `status`,- payload- )-VALUES- (- 1103,- 103,- 103,- 9002,- 10003,- 6001,- 7006,- 'Update integrationdb1',- 'bb.task.database.schema.update',- 'PENDING',- '{"statement":"ALTER TABLE integrationdb1.warehouse ADD COLUMN location VARCHAR(255);", "rollbackStatement":"ALTER TABLE integrationdb1.warehouse DROP COLUMN location;"}'- );---- Task for stage 10004 "Staging" to update database 7010 'stagingdb1'-INSERT INTO- task (- id,- creator_id,- updater_id,- pipeline_id,- stage_id,- instance_id,- database_id,- name,- `type`,- `status`,- payload- )-VALUES- (- 1104,- 103,- 103,- 9002,- 10004,- 6003,- 7010,- 'Update stagingdb1',- 'bb.task.database.schema.update',- 'PENDING_APPROVAL',- '{"statement":"ALTER TABLE stagingdb1.warehouse ADD COLUMN location VARCHAR(255);", "rollbackStatement":"ALTER TABLE stagingdb1.warehouse DROP COLUMN location;"}'- );---- Task for stage 10005 "Prod" to update database 7014 'proddb1'-INSERT INTO- task (- id,- creator_id,- updater_id,- pipeline_id,- stage_id,- instance_id,- database_id,- name,- `type`,- `status`,- payload- )-VALUES- (- 11005,- 103,- 103,- 9002,- 10005,- 6004,- 7014,- 'Update proddb1',- 'bb.task.database.schema.update',- 'PENDING_APPROVAL',- '{"statement":"ALTER TABLE proddb1.warehouse ADD COLUMN location VARCHAR(255);", "rollbackStatement":"ALTER TABLE proddb1.warehouse DROP COLUMN location;"}'- );---- Task for Pipeline 9003 create table--- Task for stage 10006 "Sandbox A" to craete table in database 7002 'sandboxdb1'-INSERT INTO- task (- id,- creator_id,- updater_id,- pipeline_id,- stage_id,- instance_id,- database_id,- name,- `type`,- `status`,- payload- )-VALUES- (- 11006,- 103,- 103,- 9003,- 10006,- 6001,- 7002,- 'Update sandboxdb1',- 'bb.task.database.schema.update',- 'PENDING_APPROVAL',- '{"statement":"CREATE TABLE sandboxdb1.tbl1 (name TEXT);", "rollbackStatement":"DROP TABLE sandboxdb1.tbl1;"}'- );---- Task for stage 10003 "Integration" to update database 7006 'integrationdb1'-INSERT INTO- task (- id,- creator_id,- updater_id,- pipeline_id,- stage_id,- instance_id,- database_id,- name,- `type`,- `status`,- payload- )-VALUES- (- 11007,- 103,- 103,- 9003,- 10007,- 6001,- 7006,- 'Update integrationdb1',- 'bb.task.database.schema.update',- 'PENDING',- '{"statement":"CREATE TABLE integrationdb1.tbl1 (name TEXT);", "rollbackStatement":"DROP TABLE integrationdb1.tbl1;"}'- );---- Task for stage 10008 "Staging" to update database 7010 'stagingdb1' to simulate webhook push event-INSERT INTO- task (- id,- creator_id,- updater_id,- pipeline_id,- stage_id,- instance_id,- database_id,- name,- `type`,- `status`,- payload- )-VALUES- (- 11008,- 1,- 1,- 9004,- 10008,- 6003,- 7010,- '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":{"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 filediff --git a/store/seed/dev/0120_task_run.sql b/store/seed/dev/0120_task_run.sqldeleted file mode 100644index 47f84bb980..0000000000--- a/store/seed/dev/0120_task_run.sql+++ /dev/null@@ -1,23 +0,0 @@--- Failed task run for task 11006 create table-INSERT INTO- task_run (- id,- creator_id,- updater_id,- task_id,- name,- `status`,- `type`,- error- )-VALUES- (- 12001,- 101,- 101,- 11006,- 'UPDATE testdb1 task run',- 'FAILED',- 'bb.task.database.schema.update',- 'fake execution error'- );\ No newline at end of filediff --git a/store/seed/dev/0130_issue.sql b/store/seed/dev/0130_issue.sqldeleted file mode 100644index af4b5967a1..0000000000--- a/store/seed/dev/0130_issue.sql+++ /dev/null@@ -1,119 +0,0 @@--- Issue for the single stage, single step "Hello world" pipeline-INSERT INTO- issue (- id,- creator_id,- updater_id,- project_id,- pipeline_id,- name,- `status`,- `type`,- description,- assignee_id,- subscriber_id_list- )-VALUES- (- 13001,- 102,- 102,- 3001,- 9001,- 'Hello world!',- 'OPEN',- 'bb.issue.general',- 'Welcome to Bytebase, this is the issue interface where tech leads, developers and DBAs collaborate on database management issues such as: ' || char(10, 10) || ' - Requesting a new database' || char(10) || ' - Creating a table' || char(10) || ' - Creating an index' || char(10) || ' - Adding a column' || char(10) || ' - Troubleshooting performance issue' || char(10, 10) || 'Let''s bookmark this issue by clicking the star icon on the top of this page.' || char(10, 10) || 'And then click the ''Approve'' button on the top right.',- 101,- '101,102,103,104'- );---- Issue for the multi stage add column pipeline-INSERT INTO- issue (- id,- creator_id,- updater_id,- project_id,- pipeline_id,- name,- `status`,- `type`,- description,- assignee_id,- subscriber_id_list- )-VALUES- (- 13002,- 103,- 103,- 3001,- 9002,- 'Add column ''location'' to table ''warehouse''',- 'OPEN',- 'bb.issue.database.schema.update',- 'Add the location column to record the warehouse address.',- 101,- '101,102,103,104'- );---- Issue for the multi stage create table pipeline-INSERT INTO- issue (- id,- creator_id,- updater_id,- project_id,- pipeline_id,- name,- `status`,- `type`,- description,- assignee_id,- subscriber_id_list- )-VALUES- (- 13003,- 103,- 103,- 3002,- 9003,- 'Create a new table ''tbl1''',- 'OPEN',- 'bb.issue.database.schema.update',- 'Create tbl1.',- 101,- '101,102,103,104'- );---- Issue for simulating webhook push event-INSERT INTO- issue (- id,- creator_id,- updater_id,- project_id,- pipeline_id,- name,- `status`,- `type`,- description,- assignee_id,- subscriber_id_list- )-VALUES- (- 13004,- 1,- 1,- 3001,- 9004,- 'Create todo table to stagingdb1',- 'OPEN',- 'bb.issue.database.schema.update',- 'Create todo table to stagingdb1',- 1,- ''- );\ No newline at end of filediff --git a/store/seed/dev/0140_activity.sql b/store/seed/dev/0140_activity.sqldeleted file mode 100644index d12abb4f8d..0000000000--- a/store/seed/dev/0140_activity.sql+++ /dev/null@@ -1,110 +0,0 @@--- Activity for issue 13001-INSERT INTO- activity (- id,- creator_id,- updater_id,- container_id,- `type`- )-VALUES- (- 14001,- 1,- 1,- 13001,- 'bb.issue.create'- );--INSERT INTO- activity (- id,- creator_id,- updater_id,- container_id,- `type`,- `comment`- )-VALUES- (- 14002,- 101,- 101,- 13001,- 'bb.issue.comment.create',- 'Welcome!'- );--INSERT INTO- activity (- id,- creator_id,- updater_id,- container_id,- `type`,- `comment`- )-VALUES- (- 14003,- 102,- 102,- 13001,- 'bb.issue.comment.create',- 'Let''s rock!'- );--INSERT INTO- activity (- id,- creator_id,- updater_id,- container_id,- `type`,- `comment`- )-VALUES- (- 14004,- 103,- 103,- 13001,- 'bb.issue.comment.create',- 'Go fish!'- );---- Activity for issue 13002-INSERT INTO- activity (- id,- creator_id,- updater_id,- container_id,- `type`- )-VALUES- (- 14005,- 103,- 103,- 13002,- 'bb.issue.create'- );---- Activity for issue 13003-INSERT INTO- activity (- id,- creator_id,- updater_id,- container_id,- `type`- )-VALUES- (- 14006,- 103,- 103,- 13003,- 'bb.issue.create'- );\ No newline at end of filediff --git a/store/seed/dev/0150_bookmark.sql b/store/seed/dev/0150_bookmark.sqldeleted file mode 100644index e69de29bb2..0000000000diff --git a/store/seed/dev/0160_vcs.sql b/store/seed/dev/0160_vcs.sqldeleted file mode 100644index 70690cb4b1..0000000000--- a/store/seed/dev/0160_vcs.sql+++ /dev/null@@ -1,61 +0,0 @@-INSERT INTO- vcs (- id,- creator_id,- updater_id,- name,- `type`,- instance_url,- api_url,- application_id,- secret,- access_token,- expires_ts,- refresh_token- )-VALUES- (- 16001,- 101,- 101,- 'GitLab Bytebase',- 'GITLAB_SELF_HOST',- 'http://gitlab.bytebase.com',- 'http://gitlab.bytebase.com/api/v4',- '0d1f706e68e3bf22be6712752726a3eec2a9684ec098a9695015f484165ed922',- '77deb508304dd73fa9b6868d319e1832889c6fc8ea087f400e6efe35d7c6dd87',- 'a6e1d552205a64c41afd377dedff745fd38a41733b2c780a506ad593ea42d27b',- 0,- 'e4b22027c3ef1847a898e2f8ef1e28056d286bc23bdd11a235711e434e447ab8'- );--INSERT INTO- vcs (- id,- creator_id,- updater_id,- name,- `type`,- instance_url,- api_url,- application_id,- secret,- access_token,- expires_ts,- refresh_token- )-VALUES- (- 16002,- 101,- 101,- 'GitLab Bytebase2',- 'GITLAB_SELF_HOST',- 'http://gitlab.bytebase.com',- 'http://gitlab.bytebase.com/api/v4',- '0d1f706e68e3bf22be6712752726a3eec2a9684ec098a9695015f484165ed922',- '77deb508304dd73fa9b6868d319e1832889c6fc8ea087f400e6efe35d7c6dd87',- 'a6e1d552205a64c41afd377dedff745fd38a41733b2c780a506ad593ea42d27b',- 0,- 'e4b22027c3ef1847a898e2f8ef1e28056d286bc23bdd11a235711e434e447ab8'- );\ No newline at end of filediff --git a/store/seed/dev/0170_repo.sql b/store/seed/dev/0170_repo.sqldeleted file mode 100644index f733c0e1a1..0000000000--- a/store/seed/dev/0170_repo.sql+++ /dev/null@@ -1,36 +0,0 @@-INSERT INTO- repo (- id,- creator_id,- updater_id,- vcs_id,- project_id,- name,- full_path,- web_url,- base_directory,- branch_filter,- external_id,- external_webhook_id,- webhook_endpoint_id,- secret_token- )-VALUES- (- 17001,- 101,- 101,- 16001,- 3001,- "project1",- "bytebase-test/project1",- "http://gitlab.bytebase.com/bytebase-test/project1",- "bytebase",- "master",- -- Refers to the bytebase-test/project1- "7",- -- Refers to the webhook in bytebase-test/project1- "5",- "8368dde4-e352-4696-9fef-26bd3af6ec40",- "VFN2lgKDRLWjJ25B"- );\ No newline at end of filediff --git a/store/seed/demo/0001_principal.sql b/store/seed/test/0001_principal.sqlsimilarity index 100%rename from store/seed/demo/0001_principal.sqlrename to store/seed/test/0001_principal.sqldiff --git a/store/seed/demo/0010_workspace.sql b/store/seed/test/0010_workspace.sqlsimilarity index 100%rename from store/seed/demo/0010_workspace.sqlrename to store/seed/test/0010_workspace.sqldiff --git a/store/seed/demo/0020_member.sql b/store/seed/test/0020_member.sqlsimilarity index 100%rename from store/seed/demo/0020_member.sqlrename to store/seed/test/0020_member.sqldiff --git a/store/seed/demo/0030_project.sql b/store/seed/test/0030_project.sqlsimilarity index 100%rename from store/seed/demo/0030_project.sqlrename to store/seed/test/0030_project.sqldiff --git a/store/seed/demo/0040_project_member.sql b/store/seed/test/0040_project_member.sqlsimilarity index 100%rename from store/seed/demo/0040_project_member.sqlrename to store/seed/test/0040_project_member.sqldiff --git a/store/seed/demo/0050_environment.sql b/store/seed/test/0050_environment.sqlsimilarity index 100%rename from store/seed/demo/0050_environment.sqlrename to store/seed/test/0050_environment.sqldiff --git a/store/seed/demo/0060_instance.sql b/store/seed/test/0060_instance.sqlsimilarity index 100%rename from store/seed/demo/0060_instance.sqlrename to store/seed/test/0060_instance.sqldiff --git a/store/seed/demo/0070_db.sql b/store/seed/test/0070_db.sqlsimilarity index 100%rename from store/seed/demo/0070_db.sqlrename to store/seed/test/0070_db.sqldiff --git a/store/seed/demo/0071_tbl.sql b/store/seed/test/0071_tbl.sqlsimilarity index 100%rename from store/seed/demo/0071_tbl.sqlrename to store/seed/test/0071_tbl.sqldiff --git a/store/seed/demo/0080_data_source.sql b/store/seed/test/0080_data_source.sqlsimilarity index 100%rename from store/seed/demo/0080_data_source.sqlrename to store/seed/test/0080_data_source.sqldiff --git a/store/seed/demo/0090_pipeline.sql b/store/seed/test/0090_pipeline.sqlsimilarity index 100%rename from store/seed/demo/0090_pipeline.sqlrename to store/seed/test/0090_pipeline.sqldiff --git a/store/seed/demo/0100_stage.sql b/store/seed/test/0100_stage.sqlsimilarity index 100%rename from store/seed/demo/0100_stage.sqlrename to store/seed/test/0100_stage.sqldiff --git a/store/seed/demo/0110_task.sql b/store/seed/test/0110_task.sqlsimilarity index 100%rename from store/seed/demo/0110_task.sqlrename to store/seed/test/0110_task.sqldiff --git a/store/seed/demo/0120_task_run.sql b/store/seed/test/0120_task_run.sqlsimilarity index 100%rename from store/seed/demo/0120_task_run.sqlrename to store/seed/test/0120_task_run.sqldiff --git a/store/seed/demo/0130_issue.sql b/store/seed/test/0130_issue.sqlsimilarity index 100%rename from store/seed/demo/0130_issue.sqlrename to store/seed/test/0130_issue.sqldiff --git a/store/seed/demo/0140_activity.sql b/store/seed/test/0140_activity.sqlsimilarity index 100%rename from store/seed/demo/0140_activity.sqlrename to store/seed/test/0140_activity.sqldiff --git a/store/seed/demo/0150_bookmark.sql b/store/seed/test/0150_bookmark.sqlsimilarity index 100%rename from store/seed/demo/0150_bookmark.sqlrename to store/seed/test/0150_bookmark.sqldiff --git a/store/seed/demo/0160_vcs.sql b/store/seed/test/0160_vcs.sqlsimilarity index 100%rename from store/seed/demo/0160_vcs.sqlrename to store/seed/test/0160_vcs.sqldiff --git a/store/seed/demo/0170_repo.sql b/store/seed/test/0170_repo.sqlsimilarity index 100%rename from store/seed/demo/0170_repo.sqlrename to store/seed/test/0170_repo.sqldiff --git a/store/sqlite.go b/store/sqlite.goindex 98bede354b..66002979e1 100644--- a/store/sqlite.go+++ b/store/sqlite.go@@ -43,8 +43,8 @@ type DB struct {// Datasource name.DSN string- // Used to identify where to load seed data- mode string+ // Dir to load seed data+ seedDir string// Returns the current time. Defaults to time.Now().// Can be mocked for tests.@@ -52,12 +52,12 @@ type DB struct {}// NewDB returns a new instance of DB associated with the given datasource name.-func NewDB(logger *zap.Logger, dsn string, mode string) *DB {+func NewDB(logger *zap.Logger, dsn string, seedDir string) *DB {db := &DB{- l: logger,- DSN: strings.Join([]string{dsn, strings.Join(pragmaList, "&")}, "?"),- mode: mode,- Now: time.Now,+ l: logger,+ DSN: strings.Join([]string{dsn, strings.Join(pragmaList, "&")}, "?"),+ seedDir: seedDir,+ Now: time.Now,}return db}@@ -94,9 +94,8 @@ func (db *DB) Open() (err error) {// seed loads the seed data for testingfunc (db *DB) seed() error {- dir := fmt.Sprintf("seed/%s", db.mode)- db.l.Info(fmt.Sprintf("Seeding database from %s...", dir))- names, err := fs.Glob(seedFS, fmt.Sprintf("%s/*.sql", dir))+ db.l.Info(fmt.Sprintf("Seeding database from %s...", db.seedDir))+ names, err := fs.Glob(seedFS, fmt.Sprintf("%s/*.sql", db.seedDir))if err != nil {return err}diff --git a/store/sqlite_trace.go b/store/sqlite_trace.goindex ebd195de4f..522a0723bd 100644--- a/store/sqlite_trace.go+++ b/store/sqlite_trace.go@@ -1,4 +1,4 @@-// +build debug+// +build !release// +build sqlite_tracepackage store