Skip to content

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

fix: fix onboarding sample query sheet (#6304)

Tianzhou (天舟)a497d463ae8e
diff --git a/backend/server/server.go b/backend/server/server.go
index 752c8375d7..acf58a9a71 100644
--- a/backend/server/server.go
+++ b/backend/server/server.go
@@ -1069,13 +1069,32 @@ func (s *Server) generateOnboardingData(ctx context.Context, userID int) error {
return errors.Wrapf(err, "failed to create onboarding SQL Review policy")
}
+ // Create a standalone sample SQL sheet.
+ // This is different from another sample SQL sheet created below, which is created as part of
+ // creating a schema change issue.
+ sheetCreate := &api.SheetCreate{
+ CreatorID: userID,
+ ProjectID: project.UID,
+ DatabaseID: &database.UID,
+ Name: "Sample Sheet",
+ Statement: "SELECT * FROM salary;",
+ Visibility: api.ProjectSheet,
+ Source: api.SheetFromBytebase,
+ Type: api.SheetForSQL,
+ }
+ _, err = s.store.CreateSheet(ctx, sheetCreate)
+ if err != nil {
+ return errors.Wrapf(err, "failed to create sample sheet")
+ }
+
+ // Create a schema update issue and start with creating the sheet for the schema update.
sheet, err := s.store.CreateSheet(ctx, &api.SheetCreate{
CreatorID: api.SystemBotID,
ProjectID: project.UID,
DatabaseID: &database.UID,
- Name: "Sheet for Sample Project",
+ Name: "Alter table sheet for Sample Issue",
Statement: "ALTER TABLE employee ADD COLUMN IF NOT EXISTS email TEXT DEFAULT '';",
Visibility: api.ProjectSheet,
Source: api.SheetFromBytebaseArtifact,
@@ -1086,7 +1105,6 @@ func (s *Server) generateOnboardingData(ctx context.Context, userID int) error {
return errors.Wrapf(err, "failed to create sheet for sample project")
}
- // Create a schema update issue.
createContext, err := json.Marshal(
&api.MigrationContext{
DetailList: []*api.MigrationDetail{
@@ -1159,21 +1177,5 @@ Click "Approve" button to apply the schema update.`,
return errors.Wrapf(err, "failed to create onboarding sensitive data policy")
}
- // Create a SQL sheet with sample queries.
- sheetCreate := &api.SheetCreate{
- CreatorID: userID,
- ProjectID: project.UID,
- DatabaseID: &database.UID,
- Name: "Sample Sheet",
- Statement: "SELECT * FROM salary;",
- Visibility: api.ProjectSheet,
- Source: api.SheetFromBytebase,
- Type: api.SheetForSQL,
- }
- _, err = s.store.CreateSheet(ctx, sheetCreate)
- if err != nil {
- return errors.Wrapf(err, "failed to create sample sheet")
- }
-
return nil
}
diff --git a/frontend/src/components/Quickstart.vue b/frontend/src/components/Quickstart.vue
index def51ba7a6..9559edbd17 100644
--- a/frontend/src/components/Quickstart.vue
+++ b/frontend/src/components/Quickstart.vue
@@ -170,7 +170,7 @@ const introList = computed(() => {
},
{
name: computed(() => t("quick-start.query-data")),
- link: "/sql-editor/sheet/sample-sheet-101",
+ link: "/sql-editor/sheet/project-sample-101",
done: computed(() => uiStateStore.getIntroStateByKey("data.query")),
},
{
diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts
index b9ff4070d8..82db330032 100644
--- a/frontend/src/router/index.ts
+++ b/frontend/src/router/index.ts
@@ -1250,7 +1250,7 @@ router.beforeEach((to, from, next) => {
// Open the "Sample Sheet" when the first time onboarding SQL Editor
onboardingStateStore.consume("sql-editor");
next({
- path: `/sql-editor/sheet/sample-sheet-101`,
+ path: `/sql-editor/sheet/project-sample-101`,
replace: true,
});
return;