Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: migrate sheet store (#10994)
ecmadaodd2485740881
diff --git a/backend/legacyapi/sheet.go b/backend/legacyapi/sheet.godeleted file mode 100644index 050b1f98a9..0000000000--- a/backend/legacyapi/sheet.go+++ /dev/null@@ -1,29 +0,0 @@-package api--// SheetVisibility is the visibility of a sheet.-type SheetVisibility string--const (- // PrivateSheet is the sheet visibility for PRIVATE. Only sheet OWNER can read/write.- PrivateSheet SheetVisibility = "PRIVATE"- // ProjectSheet is the sheet visibility for PROJECT. Both sheet OWNER and project OWNER can read/write, and project DEVELOPER can read.- ProjectSheet SheetVisibility = "PROJECT"- // PublicSheet is the sheet visibility for PUBLIC. Sheet OWNER can read/write, and all others can read.- PublicSheet SheetVisibility = "PUBLIC"-)--// SheetSource is the type of sheet origin source.-type SheetSource string--const (- // SheetFromBytebase is the sheet created by Bytebase. e.g. SQL Editor.- SheetFromBytebase SheetSource = "BYTEBASE"- // SheetFromBytebaseArtifact is the artifact sheet.- SheetFromBytebaseArtifact SheetSource = "BYTEBASE_ARTIFACT"- // 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"- // SheetFromBitbucket is the sheet synced from Bitbucket.- SheetFromBitbucket SheetSource = "BITBUCKET"-)diff --git a/backend/metric/collector/sheet_count.go b/backend/metric/collector/sheet_count.goindex 0c24242f5e..98d605b6ac 100644--- a/backend/metric/collector/sheet_count.go+++ b/backend/metric/collector/sheet_count.go@@ -38,7 +38,6 @@ func (c *sheetCountCollector) Collect(ctx context.Context) ([]*metric.Metric, erLabels: map[string]any{"row_status": string(sheetCountMetric.RowStatus),"visibility": string(sheetCountMetric.Visibility),- "source": string(sheetCountMetric.Source),},})}diff --git a/backend/metric/metric.go b/backend/metric/metric.goindex db49f37649..121c2d6c7c 100644--- a/backend/metric/metric.go+++ b/backend/metric/metric.go@@ -97,8 +97,7 @@ type DatabaseCountMetric struct {// SheetCountMetric is the API message for sheet count metric.type SheetCountMetric struct {RowStatus api.RowStatus- Visibility api.SheetVisibility- Source api.SheetSource+ Visibility stringCount int}diff --git a/backend/migrator/migration/dev/LATEST.sql b/backend/migrator/migration/dev/LATEST.sqlindex 06c3357d0d..d52f5af8e4 100644--- a/backend/migrator/migration/dev/LATEST.sql+++ b/backend/migrator/migration/dev/LATEST.sql@@ -1061,9 +1061,6 @@ CREATE TABLE sheet (database_id INTEGER NULL REFERENCES db (id),name TEXT NOT NULL,statement TEXT NOT NULL,- visibility TEXT NOT NULL CHECK (visibility IN ('PRIVATE', 'PROJECT', 'PUBLIC')) DEFAULT 'PRIVATE',- source TEXT NOT NULL CONSTRAINT sheet_source_check CHECK (source IN ('BYTEBASE', 'GITLAB', 'GITHUB', 'BITBUCKET', 'AZURE_DEVOPS', 'BYTEBASE_ARTIFACT')) DEFAULT 'BYTEBASE',- type TEXT NOT NULL CHECK (type IN ('SQL')) DEFAULT 'SQL',payload JSONB NOT NULL DEFAULT '{}');@@ -1085,10 +1082,35 @@ UPDATEON sheet FOR EACH ROWEXECUTE FUNCTION trigger_update_updated_ts();+CREATE TABLE worksheet (+ id SERIAL PRIMARY KEY,+ row_status row_status NOT NULL DEFAULT 'NORMAL',+ creator_id INTEGER NOT NULL REFERENCES principal (id),+ created_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),+ updater_id INTEGER NOT NULL REFERENCES principal (id),+ updated_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),+ project_id INTEGER NOT NULL REFERENCES project (id),+ database_id INTEGER NULL REFERENCES db (id),+ name TEXT NOT NULL,+ statement TEXT NOT NULL,+ visibility TEXT NOT NULL,+ payload JSONB NOT NULL DEFAULT '{}'+);++CREATE INDEX idx_worksheet_creator_id_project_id ON worksheet(creator_id, project_id);++ALTER SEQUENCE worksheet_id_seq RESTART WITH 101;++CREATE TRIGGER update_worksheet_updated_ts+BEFORE+UPDATE+ ON worksheet FOR EACH ROW+EXECUTE FUNCTION trigger_update_updated_ts();+-- sheet_organizer table stores the sheet status for a principal.CREATE TABLE sheet_organizer (id SERIAL PRIMARY KEY,- sheet_id INTEGER NOT NULL REFERENCES sheet (id) ON DELETE CASCADE,+ sheet_id INTEGER NOT NULL REFERENCES worksheet (id) ON DELETE CASCADE,principal_id INTEGER NOT NULL REFERENCES principal (id),starred BOOLEAN NOT NULL DEFAULT false,pinned BOOLEAN NOT NULL DEFAULT falsediff --git a/backend/migrator/migration/prod/2.14/0001##worksheet.sql b/backend/migrator/migration/prod/2.14/0001##worksheet.sqlnew file mode 100644index 0000000000..27a4184529--- /dev/null+++ b/backend/migrator/migration/prod/2.14/0001##worksheet.sql@@ -0,0 +1,61 @@+-- Create worksheet table.+CREATE TABLE worksheet (+ id SERIAL PRIMARY KEY,+ row_status row_status NOT NULL DEFAULT 'NORMAL',+ creator_id INTEGER NOT NULL REFERENCES principal (id),+ created_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),+ updater_id INTEGER NOT NULL REFERENCES principal (id),+ updated_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),+ project_id INTEGER NOT NULL REFERENCES project (id),+ database_id INTEGER NULL REFERENCES db (id),+ name TEXT NOT NULL,+ statement TEXT NOT NULL,+ visibility TEXT NOT NULL,+ payload JSONB NOT NULL DEFAULT '{}'+);++CREATE INDEX idx_worksheet_creator_id_project_id ON worksheet(creator_id, project_id);++CREATE TRIGGER update_worksheet_updated_ts+BEFORE+UPDATE+ ON worksheet FOR EACH ROW+EXECUTE FUNCTION trigger_update_updated_ts();++-- Migrate sheet with BYTEBASE source to the worksheet table.+INSERT INTO worksheet+ (id, creator_id, created_ts, updater_id, updated_ts, project_id, database_id, name, statement, visibility, payload)+SELECT+ sheet.id,+ sheet.creator_id,+ sheet.created_ts,+ sheet.updater_id,+ sheet.updated_ts,+ sheet.project_id,+ sheet.database_id,+ sheet.name,+ sheet.statement,+ sheet.visibility,+ sheet.payload+FROM sheet+WHERE sheet.source = 'BYTEBASE';++-- Change fk for sheet_organizer.+ALTER TABLE sheet_organizer DROP CONSTRAINT sheet_organizer_sheet_id_fkey;+ALTER TABLE sheet_organizer ADD CONSTRAINT sheet_organizer_sheet_id_fkey FOREIGN KEY (sheet_id) REFERENCES worksheet (id);++-- Remove worksheet from sheet.+DELETE FROM sheet WHERE sheet.source = 'BYTEBASE';++-- Drop legacy fields for sheet.+ALTER TABLE sheet DROP CONSTRAINT sheet_visibility_check;+ALTER TABLE sheet DROP COLUMN visibility;++ALTER TABLE sheet DROP CONSTRAINT sheet_type_check;+ALTER TABLE sheet DROP COLUMN type;++ALTER TABLE sheet DROP CONSTRAINT sheet_source_check;+ALTER TABLE sheet DROP COLUMN source;++-- Reset workspace id sequence.+SELECT setval('worksheet_id_seq', GREATEST((SELECT MAX(id) FROM worksheet), 101));\ No newline at end of filediff --git a/backend/migrator/migration/prod/LATEST.sql b/backend/migrator/migration/prod/LATEST.sqlindex f79cad5731..81d138ea38 100644--- a/backend/migrator/migration/prod/LATEST.sql+++ b/backend/migrator/migration/prod/LATEST.sql@@ -1060,9 +1060,6 @@ CREATE TABLE sheet (database_id INTEGER NULL REFERENCES db (id),name TEXT NOT NULL,statement TEXT NOT NULL,- visibility TEXT NOT NULL CHECK (visibility IN ('PRIVATE', 'PROJECT', 'PUBLIC')) DEFAULT 'PRIVATE',- source TEXT NOT NULL CONSTRAINT sheet_source_check CHECK (source IN ('BYTEBASE', 'GITLAB', 'GITHUB', 'BITBUCKET', 'AZURE_DEVOPS', 'BYTEBASE_ARTIFACT')) DEFAULT 'BYTEBASE',- type TEXT NOT NULL CHECK (type IN ('SQL')) DEFAULT 'SQL',payload JSONB NOT NULL DEFAULT '{}');@@ -1084,10 +1081,35 @@ UPDATEON sheet FOR EACH ROWEXECUTE FUNCTION trigger_update_updated_ts();+CREATE TABLE worksheet (+ id SERIAL PRIMARY KEY,+ row_status row_status NOT NULL DEFAULT 'NORMAL',+ creator_id INTEGER NOT NULL REFERENCES principal (id),+ created_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),+ updater_id INTEGER NOT NULL REFERENCES principal (id),+ updated_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),+ project_id INTEGER NOT NULL REFERENCES project (id),+ database_id INTEGER NULL REFERENCES db (id),+ name TEXT NOT NULL,+ statement TEXT NOT NULL,+ visibility TEXT NOT NULL,+ payload JSONB NOT NULL DEFAULT '{}'+);++CREATE INDEX idx_worksheet_creator_id_project_id ON worksheet(creator_id, project_id);++ALTER SEQUENCE worksheet_id_seq RESTART WITH 101;++CREATE TRIGGER update_worksheet_updated_ts+BEFORE+UPDATE+ ON worksheet FOR EACH ROW+EXECUTE FUNCTION trigger_update_updated_ts();+-- sheet_organizer table stores the sheet status for a principal.CREATE TABLE sheet_organizer (id SERIAL PRIMARY KEY,- sheet_id INTEGER NOT NULL REFERENCES sheet (id) ON DELETE CASCADE,+ sheet_id INTEGER NOT NULL REFERENCES worksheet (id) ON DELETE CASCADE,principal_id INTEGER NOT NULL REFERENCES principal (id),starred BOOLEAN NOT NULL DEFAULT false,pinned BOOLEAN NOT NULL DEFAULT falsediff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.goindex 8c3c9d2006..dd7e4503e8 100644--- a/backend/migrator/migrator_test.go+++ b/backend/migrator/migrator_test.go@@ -230,5 +230,5 @@ func TestMigrationCompatibility(t *testing.T) {func TestGetCutoffVersion(t *testing.T) {releaseVersion, err := getProdCutoffVersion()require.NoError(t, err)- require.Equal(t, semver.MustParse("2.14.0"), releaseVersion)+ require.Equal(t, semver.MustParse("2.14.1"), releaseVersion)}diff --git a/backend/store/plan.go b/backend/store/plan.goindex e1e2e6225f..26c67f4443 100644--- a/backend/store/plan.go+++ b/backend/store/plan.go@@ -135,7 +135,7 @@ func (s *Store) ListPlans(ctx context.Context, find *FindPlanMessage) ([]*PlanMe}query := fmt.Sprintf(`SELECT- plan.id,+ plan.id,plan.creator_id,plan.created_ts,plan.updater_id,diff --git a/backend/store/sheet.go b/backend/store/sheet.goindex 68ca8d37c3..f09ae8e897 100644--- a/backend/store/sheet.go+++ b/backend/store/sheet.go@@ -14,24 +14,6 @@ import (storepb "github.com/bytebase/bytebase/proto/generated-go/store")-// SheetSource is the type of sheet origin source.-type SheetSource string--const (- // SheetFromBytebase is the sheet created by Bytebase. e.g. SQL Editor.- SheetFromBytebase SheetSource = "BYTEBASE"- // SheetFromBytebaseArtifact is the artifact sheet.- SheetFromBytebaseArtifact SheetSource = "BYTEBASE_ARTIFACT"-)--// SheetType is the type of sheet.-type SheetType string--const (- // SheetForSQL is the sheet that used for saving SQL statements.- SheetForSQL SheetType = "SQL"-)-// SheetMessage is the message for a sheet.type SheetMessage struct {ProjectUID int@@ -120,8 +102,6 @@ func (s *Store) GetSheet(ctx context.Context, find *FindSheetMessage) (*SheetMes// listSheets returns a list of sheets.func (s *Store) listSheets(ctx context.Context, find *FindSheetMessage) ([]*SheetMessage, error) {where, args := []string{"TRUE"}, []any{}- where, args = append(where, fmt.Sprintf("sheet.source = $%d", len(args)+1)), append(args, SheetFromBytebaseArtifact)- where, args = append(where, fmt.Sprintf("sheet.type = $%d", len(args)+1)), append(args, SheetForSQL)// Standard fieldsif v := find.UID; v != nil {@@ -230,12 +210,9 @@ func (s *Store) CreateSheet(ctx context.Context, create *SheetMessage) (*SheetMedatabase_id,name,statement,- visibility,- source,- type,payload)- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)+ VALUES ($1, $2, $3, $4, $5, $6, $7)RETURNING id, created_ts, updated_ts, OCTET_LENGTH(statement)`@@ -252,9 +229,6 @@ func (s *Store) CreateSheet(ctx context.Context, create *SheetMessage) (*SheetMecreate.DatabaseUID,create.Title,create.Statement,- ProjectWorkSheet,- SheetFromBytebaseArtifact,- SheetForSQL,payload,).Scan(&create.UID,@@ -318,7 +292,7 @@ func (s *Store) DeleteSheet(ctx context.Context, sheetUID int) error {return nil}-// patchSheetImpl updates a sheet's name/statement/visibility/payload/database_id/project_id.+// patchSheetImpl updates a sheet's name/statement/payload/database_id/project_id.func patchSheetImpl(ctx context.Context, tx *Tx, patch *PatchSheetMessage) (*SheetMessage, error) {set, args := []string{"updater_id = $1"}, []any{patch.UpdaterID}if v := patch.Statement; v != nil {diff --git a/backend/store/stats.go b/backend/store/stats.goindex 79586ee350..170b20425c 100644--- a/backend/store/stats.go+++ b/backend/store/stats.go@@ -352,9 +352,9 @@ func (s *Store) CountSheetGroupByRowstatusVisibilitySourceAndType(ctx context.Codefer tx.Rollback()rows, err := tx.QueryContext(ctx, `- SELECT row_status, visibility, source, COUNT(*) AS count- FROM sheet- GROUP BY row_status, visibility, source`)+ SELECT row_status, visibility, COUNT(*) AS count+ FROM worksheet+ GROUP BY row_status, visibility`)if err != nil {return nil, err}@@ -366,7 +366,6 @@ func (s *Store) CountSheetGroupByRowstatusVisibilitySourceAndType(ctx context.Coif err := rows.Scan(&sheetCount.RowStatus,&sheetCount.Visibility,- &sheetCount.Source,&sheetCount.Count,); err != nil {return nil, errdiff --git a/backend/store/worksheet.go b/backend/store/worksheet.goindex 05be10e527..4a64a82086 100644--- a/backend/store/worksheet.go+++ b/backend/store/worksheet.go@@ -109,19 +109,17 @@ func (s *Store) GetWorkSheet(ctx context.Context, find *FindWorkSheetMessage, cu// ListWorkSheets returns a list of sheets.func (s *Store) ListWorkSheets(ctx context.Context, find *FindWorkSheetMessage, currentPrincipalID int) ([]*WorkSheetMessage, error) {where, args := []string{"TRUE"}, []any{}- where, args = append(where, fmt.Sprintf("sheet.source = $%d", len(args)+1)), append(args, SheetFromBytebase)- where, args = append(where, fmt.Sprintf("sheet.type = $%d", len(args)+1)), append(args, SheetForSQL)if v := find.UID; v != nil {- where, args = append(where, fmt.Sprintf("sheet.id = $%d", len(args)+1)), append(args, *v)+ where, args = append(where, fmt.Sprintf("worksheet.id = $%d", len(args)+1)), append(args, *v)}// Standard fieldsif v := find.CreatorID; v != nil {- where, args = append(where, fmt.Sprintf("sheet.creator_id = $%d", len(args)+1)), append(args, *v)+ where, args = append(where, fmt.Sprintf("worksheet.creator_id = $%d", len(args)+1)), append(args, *v)}if v := find.ExcludedCreatorID; v != nil {- where, args = append(where, fmt.Sprintf("sheet.creator_id != $%d", len(args)+1)), append(args, *v)+ where, args = append(where, fmt.Sprintf("worksheet.creator_id != $%d", len(args)+1)), append(args, *v)}// Domain fields@@ -133,17 +131,17 @@ func (s *Store) ListWorkSheets(ctx context.Context, find *FindWorkSheetMessage,where = append(where, fmt.Sprintf("(%s)", strings.Join(visibilitiesWhere, " OR ")))}if v := find.PrincipalID; v != nil {- where, args = append(where, fmt.Sprintf("sheet.project_id IN (SELECT project_id FROM project_member WHERE principal_id = $%d)", len(args)+1)), append(args, *v)+ where, args = append(where, fmt.Sprintf("worksheet.project_id IN (SELECT project_id FROM project_member WHERE principal_id = $%d)", len(args)+1)), append(args, *v)}if v := find.OrganizerPrincipalIDStarred; v != nil {- where, args = append(where, fmt.Sprintf("sheet.id IN (SELECT sheet_id FROM sheet_organizer WHERE principal_id = $%d AND starred = true)", len(args)+1)), append(args, *v)+ where, args = append(where, fmt.Sprintf("worksheet.id IN (SELECT sheet_id FROM sheet_organizer WHERE principal_id = $%d AND starred = true)", len(args)+1)), append(args, *v)}if v := find.OrganizerPrincipalIDNotStarred; v != nil {- where, args = append(where, fmt.Sprintf("sheet.id IN (SELECT sheet_id FROM sheet_organizer WHERE principal_id = $%d AND starred = false)", len(args)+1)), append(args, *v)+ where, args = append(where, fmt.Sprintf("worksheet.id IN (SELECT sheet_id FROM sheet_organizer WHERE principal_id = $%d AND starred = false)", len(args)+1)), append(args, *v)}- statementField := fmt.Sprintf("LEFT(sheet.statement, %d)", common.MaxSheetSize)+ statementField := fmt.Sprintf("LEFT(worksheet.statement, %d)", common.MaxSheetSize)if find.LoadFull {- statementField = "sheet.statement"+ statementField = "worksheet.statement"}tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})@@ -154,21 +152,21 @@ func (s *Store) ListWorkSheets(ctx context.Context, find *FindWorkSheetMessage,rows, err := tx.QueryContext(ctx, fmt.Sprintf(`SELECT- sheet.id,- sheet.creator_id,- sheet.created_ts,- sheet.updater_id,- sheet.updated_ts,- sheet.project_id,- sheet.database_id,- sheet.name,+ worksheet.id,+ worksheet.creator_id,+ worksheet.created_ts,+ worksheet.updater_id,+ worksheet.updated_ts,+ worksheet.project_id,+ worksheet.database_id,+ worksheet.name,%s,- sheet.visibility,- OCTET_LENGTH(sheet.statement),+ worksheet.visibility,+ OCTET_LENGTH(worksheet.statement),COALESCE(sheet_organizer.starred, FALSE),COALESCE(sheet_organizer.pinned, FALSE)- FROM sheet- LEFT JOIN sheet_organizer ON sheet_organizer.sheet_id = sheet.id AND sheet_organizer.principal_id = %d+ FROM worksheet+ LEFT JOIN sheet_organizer ON sheet_organizer.sheet_id = worksheet.id AND sheet_organizer.principal_id = %dWHERE %s`, statementField, currentPrincipalID, strings.Join(where, " AND ")),args...,)@@ -223,7 +221,7 @@ func (s *Store) CreateWorkSheet(ctx context.Context, create *WorkSheetMessage) (}query := `- INSERT INTO sheet (+ INSERT INTO worksheet (creator_id,updater_id,project_id,@@ -231,11 +229,9 @@ func (s *Store) CreateWorkSheet(ctx context.Context, create *WorkSheetMessage) (name,statement,visibility,- source,- type,payload)- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8)RETURNING id, created_ts, updated_ts, OCTET_LENGTH(statement)`@@ -253,8 +249,6 @@ func (s *Store) CreateWorkSheet(ctx context.Context, create *WorkSheetMessage) (create.Title,create.Statement,create.Visibility,- SheetFromBytebase,- SheetForSQL,payload,).Scan(&create.UID,@@ -279,7 +273,6 @@ func (s *Store) CreateWorkSheet(ctx context.Context, create *WorkSheetMessage) (// PatchWorkSheet updates a sheet.func (s *Store) PatchWorkSheet(ctx context.Context, patch *PatchWorkSheetMessage) (*WorkSheetMessage, error) {- // return s.PatchSheet(ctx, &PatchSheetMessage{})tx, err := s.db.BeginTx(ctx, nil)if err != nil {return nil, errors.Wrapf(err, "failed to begin transaction")@@ -293,13 +286,22 @@ func (s *Store) PatchWorkSheet(ctx context.Context, patch *PatchWorkSheetMessageif err := tx.Commit(); err != nil {return nil, errors.Wrapf(err, "failed to commit transaction")}- s.sheetCache.Remove(patch.UID)return sheet, nil}// DeleteWorkSheet deletes an existing sheet by ID.func (s *Store) DeleteWorkSheet(ctx context.Context, sheetUID int) error {- return s.DeleteSheet(ctx, sheetUID)+ tx, err := s.db.BeginTx(ctx, nil)+ if err != nil {+ return err+ }+ defer tx.Rollback()++ if _, err := tx.ExecContext(ctx, `DELETE FROM worksheet WHERE id = $1`, sheetUID); err != nil {+ return err+ }++ return tx.Commit()}// patchWorkSheetImpl updates a sheet's name/statement/visibility/database_id/project_id.@@ -321,10 +323,21 @@ func patchWorkSheetImpl(ctx context.Context, tx *Tx, patch *PatchWorkSheetMessagdatabaseID := sql.NullInt32{}if err := tx.QueryRowContext(ctx, fmt.Sprintf(`- UPDATE sheet+ UPDATE worksheetSET `+strings.Join(set, ", ")+`WHERE id = $%d- RETURNING id, creator_id, created_ts, updater_id, updated_ts, project_id, database_id, name, LEFT(statement, %d), visibility, OCTET_LENGTH(statement)+ RETURNING+ id,+ creator_id,+ created_ts,+ updater_id,+ updated_ts,+ project_id,+ database_id,+ name,+ LEFT(statement, %d),+ visibility,+ OCTET_LENGTH(statement)`, len(args), common.MaxSheetSize),args...,).Scan(@@ -346,6 +359,19 @@ func patchWorkSheetImpl(ctx context.Context, tx *Tx, patch *PatchWorkSheetMessagreturn nil, err}+ if err := tx.QueryRowContext(ctx, `+ SELECT+ COALESCE(sheet_organizer.starred, FALSE),+ COALESCE(sheet_organizer.pinned, FALSE)+ FROM sheet_organizer+ WHERE sheet_organizer.sheet_id = $1+ `, sheet.UID).Scan(+ &sheet.Starred,+ &sheet.Pinned,+ ); err != nil {+ return nil, err+ }+if databaseID.Valid {value := int(databaseID.Int32)sheet.DatabaseUID = &valuediff --git a/frontend/src/store/modules/v1/worksheet.ts b/frontend/src/store/modules/v1/worksheet.tsindex 2ca96f85ac..ce0a2a8b8c 100644--- a/frontend/src/store/modules/v1/worksheet.ts+++ b/frontend/src/store/modules/v1/worksheet.ts@@ -152,6 +152,7 @@ export const useWorkSheetStore = defineStore("worksheet_v1", () => {setListCache(worksheets);return worksheets;};+const fetchStarredSheetList = async () => {const { worksheets } = await worksheetServiceClient.searchWorksheets({filter: `starred = true`,@@ -193,10 +194,12 @@ export const useWorkSheetStore = defineStore("worksheet_v1", () => {const fullViewWorksheet = getSheetByName(organizer.worksheet, "FULL");if (fullViewWorksheet) {fullViewWorksheet.starred = organizer.starred;+ setCache(fullViewWorksheet, "FULL");}const basicViewWorksheet = getSheetByName(organizer.worksheet, "BASIC");if (basicViewWorksheet) {basicViewWorksheet.starred = organizer.starred;+ setCache(basicViewWorksheet, "BASIC");}};