Skip to content

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

Move level from inbox to activity table

天舟5fdebed97f7e
diff --git a/api/activity.go b/api/activity.go
index 120d78ec8a..abac54d572 100644
--- a/api/activity.go
+++ b/api/activity.go
@@ -47,6 +47,26 @@ func (e ActivityType) String() string {
return "bb.activity.unknown"
}
+type ActivityLevel string
+
+const (
+ ACTIVITY_INFO ActivityLevel = "INFO"
+ ACTIVITY_WARNING ActivityLevel = "WARNING"
+ ACTIVITY_ERROR ActivityLevel = "ERROR"
+)
+
+func (e ActivityLevel) String() string {
+ switch e {
+ case ACTIVITY_INFO:
+ return "INFO"
+ case ACTIVITY_WARNING:
+ return "WARNING"
+ case ACTIVITY_ERROR:
+ return "ERROR"
+ }
+ return "UNKNOWN"
+}
+
// These payload types are only used when marshalling to the json format for saving into the database.
// So we annotate with json tag using camelCase naming which is consistent with normal
// json naming convention. More importantly, frontend code can simply use JSON.parse to
@@ -127,9 +147,10 @@ type Activity struct {
ContainerId int `jsonapi:"attr,containerId"`
// Domain specific fields
- Type ActivityType `jsonapi:"attr,actionType"`
- Comment string `jsonapi:"attr,comment"`
- Payload string `jsonapi:"attr,payload"`
+ Type ActivityType `jsonapi:"attr,actionType"`
+ Level ActivityLevel `jsonapi:"attr,level"`
+ Comment string `jsonapi:"attr,comment"`
+ Payload string `jsonapi:"attr,payload"`
}
type ActivityCreate struct {
@@ -140,8 +161,9 @@ type ActivityCreate struct {
// Domain specific fields
ContainerId int `jsonapi:"attr,containerId"`
Type ActivityType `jsonapi:"attr,actionType"`
- Comment string `jsonapi:"attr,comment"`
- Payload string `jsonapi:"attr,payload"`
+ Level ActivityLevel
+ Comment string `jsonapi:"attr,comment"`
+ Payload string `jsonapi:"attr,payload"`
}
type ActivityFind struct {
diff --git a/api/inbox.go b/api/inbox.go
index 6ca282739d..ecc78290cd 100644
--- a/api/inbox.go
+++ b/api/inbox.go
@@ -22,26 +22,6 @@ func (e InboxStatus) String() string {
return "UNKNOWN"
}
-type InboxLevel string
-
-const (
- INBOX_INFO InboxLevel = "INFO"
- INBOX_WARNING InboxLevel = "WARNING"
- INBOX_ERROR InboxLevel = "ERROR"
-)
-
-func (e InboxLevel) String() string {
- switch e {
- case INBOX_INFO:
- return "INFO"
- case INBOX_WARNING:
- return "WARNING"
- case INBOX_ERROR:
- return "ERROR"
- }
- return "UNKNOWN"
-}
-
type Inbox struct {
ID int `jsonapi:"primary,inbox"`
@@ -49,14 +29,12 @@ type Inbox struct {
ReceiverId int `jsonapi:"attr,receiverId"`
Activity *Activity `jsonapi:"relation,activity"`
Status InboxStatus `jsonapi:"attr,status"`
- Level InboxLevel `jsonapi:"attr,level"`
}
type InboxCreate struct {
// Domain specific fields
ReceiverId int
ActivityId int
- Level InboxLevel
}
type InboxFind struct {
diff --git a/frontend/src/components/InboxList.vue b/frontend/src/components/InboxList.vue
index cae2fa5507..9673dd5a49 100644
--- a/frontend/src/components/InboxList.vue
+++ b/frontend/src/components/InboxList.vue
@@ -33,7 +33,7 @@
>
</template>
<span> {{ actionSentence(inbox.activity) }}</span>
- <template v-if="inbox.level == 'WARNING'">
+ <template v-if="inbox.activity.level == 'WARNING'">
<svg
class="ml-1 h-6 w-6 text-warning"
xmlns="http://www.w3.org/2000/svg"
@@ -50,7 +50,7 @@
></path>
</svg>
</template>
- <template v-else-if="inbox.level == 'ERROR'">
+ <template v-else-if="inbox.activity.level == 'ERROR'">
<svg
class="ml-1 w-6 h-6 text-error"
fill="none"
diff --git a/frontend/src/types/activity.ts b/frontend/src/types/activity.ts
index 082d222c7e..2a20e6ab91 100644
--- a/frontend/src/types/activity.ts
+++ b/frontend/src/types/activity.ts
@@ -20,6 +20,8 @@ export type MemberActionType =
export type ActionType = IssueActionType | MemberActionType;
+export type ActivityLevel = "INFO" | "WARNING" | "ERROR";
+
export type ActionIssueCreatePayload = {
issueName: string;
};
@@ -96,6 +98,7 @@ export type Activity = {
// e.g if actionType is "bb.issue.xxx", then this field refers to the corresponding issue's id.
containerId: ContainerId;
actionType: ActionType;
+ level: ActivityLevel;
comment: string;
payload?: ActionPayloadType;
};
diff --git a/frontend/src/types/common.ts b/frontend/src/types/common.ts
index 91a23f08ff..e56ad9973e 100644
--- a/frontend/src/types/common.ts
+++ b/frontend/src/types/common.ts
@@ -4,7 +4,7 @@ import { Database } from "./database";
import { DataSource } from "./dataSource";
import { Environment } from "./environment";
import { CommandId, CommandRegisterId, PrincipalId } from "./id";
-import { Message } from "./inbox";
+import { Inbox } from "./inbox";
import { Instance } from "./instance";
import { Issue } from "./issue";
import { Member } from "./member";
@@ -114,7 +114,7 @@ export const unknown = (
| Stage
| Task
| Activity
- | Message
+ | Inbox
| Bookmark
| VCS
| Repository => {
diff --git a/frontend/src/types/inbox.ts b/frontend/src/types/inbox.ts
index c298657cfd..764c014ced 100644
--- a/frontend/src/types/inbox.ts
+++ b/frontend/src/types/inbox.ts
@@ -3,8 +3,6 @@ import { InboxId, PrincipalId } from "./id";
export type InboxStatus = "UNREAD" | "READ";
-export type InboxLevel = "INFO" | "WARNING" | "ERROR";
-
export type Inbox = {
id: InboxId;
@@ -12,7 +10,6 @@ export type Inbox = {
receiver_id: PrincipalId;
activity: Activity;
status: InboxStatus;
- level: InboxLevel;
};
export type InboxPatch = {
diff --git a/server/activity.go b/server/activity.go
index 0c80040308..84e0b137d6 100644
--- a/server/activity.go
+++ b/server/activity.go
@@ -20,6 +20,7 @@ func (s *Server) registerActivityRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create activity request").SetInternal(err)
}
+ activityCreate.Level = api.ACTIVITY_INFO
activityCreate.CreatorId = c.Get(GetPrincipalIdContextKey()).(int)
var foundIssue *api.Issue
if activityCreate.Type == api.ActivityIssueCommentCreate {
@@ -50,7 +51,7 @@ func (s *Server) registerActivityRoutes(g *echo.Group) {
}
if activityCreate.Type == api.ActivityIssueCommentCreate {
- if err := s.PostInboxIssueActivity(context.Background(), foundIssue, activity.ID, api.INBOX_INFO); err != nil {
+ if err := s.PostInboxIssueActivity(context.Background(), foundIssue, activity.ID); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to post activity to inbox").SetInternal(err)
}
}
diff --git a/server/auth.go b/server/auth.go
index aca5df69d3..30fbb1c73d 100644
--- a/server/auth.go
+++ b/server/auth.go
@@ -144,13 +144,14 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
CreatorId: user.ID,
ContainerId: member.ID,
Type: api.ActivityMemberCreate,
+ Level: api.ACTIVITY_INFO,
Payload: string(bytes),
})
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to create activity after create member: %d", member.ID)).SetInternal(err)
}
- if err := s.PostInboxMemberActivity(context.Background(), member, activity.ID, api.INBOX_INFO); err != nil {
+ if err := s.PostInboxMemberActivity(context.Background(), member, activity.ID); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to post activity to inbox").SetInternal(err)
}
}
diff --git a/server/issue.go b/server/issue.go
index 1c2edea1b4..b4756942fa 100644
--- a/server/issue.go
+++ b/server/issue.go
@@ -188,13 +188,14 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {
CreatorId: c.Get(GetPrincipalIdContextKey()).(int),
ContainerId: issue.ID,
Type: api.ActivityIssueFieldUpdate,
+ Level: api.ACTIVITY_INFO,
Payload: string(payload),
})
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to create activity after updating issue: %v", updatedIssue.Name)).SetInternal(err)
}
- if err := s.PostInboxIssueActivity(context.Background(), issue, activity.ID, api.INBOX_INFO); err != nil {
+ if err := s.PostInboxIssueActivity(context.Background(), issue, activity.ID); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to post activity to inbox after updating issue: %v", updatedIssue.Name)).SetInternal(err)
}
}
@@ -399,6 +400,7 @@ func (s *Server) CreateIssue(ctx context.Context, issueCreate *api.IssueCreate,
CreatorId: creatorId,
ContainerId: issue.ID,
Type: api.ActivityIssueCreate,
+ Level: api.ACTIVITY_INFO,
Payload: string(bytes),
}
activity, err := s.ActivityService.CreateActivity(context.Background(), activityCreate)
@@ -406,7 +408,7 @@ func (s *Server) CreateIssue(ctx context.Context, issueCreate *api.IssueCreate,
return nil, fmt.Errorf("failed to create activity after creating the issue: %v. Error %w", issue.Name, err)
}
- if err := s.PostInboxIssueActivity(context.Background(), issue, activity.ID, api.INBOX_INFO); err != nil {
+ if err := s.PostInboxIssueActivity(context.Background(), issue, activity.ID); err != nil {
return nil, err
}
@@ -487,6 +489,7 @@ func (s *Server) ChangeIssueStatus(ctx context.Context, issue *api.Issue, newSta
CreatorId: updatorId,
ContainerId: issue.ID,
Type: api.ActivityIssueStatusUpdate,
+ Level: api.ACTIVITY_INFO,
Comment: comment,
Payload: string(payload),
}
@@ -495,19 +498,18 @@ func (s *Server) ChangeIssueStatus(ctx context.Context, issue *api.Issue, newSta
return nil, fmt.Errorf("failed to create activity after changing the issue status: %v, error: %w", issue.Name, err)
}
- if err := s.PostInboxIssueActivity(context.Background(), issue, activity.ID, api.INBOX_INFO); err != nil {
+ if err := s.PostInboxIssueActivity(context.Background(), issue, activity.ID); err != nil {
return nil, err
}
return updatedIssue, nil
}
-func (s *Server) PostInboxIssueActivity(ctx context.Context, issue *api.Issue, activity_id int, level api.InboxLevel) error {
+func (s *Server) PostInboxIssueActivity(ctx context.Context, issue *api.Issue, activity_id int) error {
if issue.CreatorId != api.SYSTEM_BOT_ID {
inboxCreate := &api.InboxCreate{
ReceiverId: issue.CreatorId,
ActivityId: activity_id,
- Level: level,
}
_, err := s.InboxService.CreateInbox(context.Background(), inboxCreate)
if err != nil {
@@ -519,7 +521,6 @@ func (s *Server) PostInboxIssueActivity(ctx context.Context, issue *api.Issue, a
inboxCreate := &api.InboxCreate{
ReceiverId: issue.AssigneeId,
ActivityId: activity_id,
- Level: level,
}
_, err := s.InboxService.CreateInbox(context.Background(), inboxCreate)
if err != nil {
@@ -532,7 +533,6 @@ func (s *Server) PostInboxIssueActivity(ctx context.Context, issue *api.Issue, a
inboxCreate := &api.InboxCreate{
ReceiverId: subscriberId,
ActivityId: activity_id,
- Level: level,
}
_, err := s.InboxService.CreateInbox(context.Background(), inboxCreate)
if err != nil {
diff --git a/server/member.go b/server/member.go
index c74d88603b..e899a7df26 100644
--- a/server/member.go
+++ b/server/member.go
@@ -57,13 +57,14 @@ func (s *Server) registerMemberRoutes(g *echo.Group) {
CreatorId: c.Get(GetPrincipalIdContextKey()).(int),
ContainerId: member.ID,
Type: api.ActivityMemberCreate,
+ Level: api.ACTIVITY_INFO,
Payload: string(bytes),
})
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to create activity after creating member: %d", member.ID)).SetInternal(err)
}
- if err := s.PostInboxMemberActivity(context.Background(), member, activity.ID, api.INBOX_INFO); err != nil {
+ if err := s.PostInboxMemberActivity(context.Background(), member, activity.ID); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to post activity to inbox").SetInternal(err)
}
}
@@ -185,6 +186,7 @@ func (s *Server) registerMemberRoutes(g *echo.Group) {
CreatorId: c.Get(GetPrincipalIdContextKey()).(int),
ContainerId: updatedMember.ID,
Type: theType,
+ Level: api.ACTIVITY_INFO,
Payload: string(bytes),
})
if err != nil {
@@ -193,7 +195,7 @@ func (s *Server) registerMemberRoutes(g *echo.Group) {
activity = createdActivity
}
- if err := s.PostInboxMemberActivity(context.Background(), updatedMember, activity.ID, api.INBOX_INFO); err != nil {
+ if err := s.PostInboxMemberActivity(context.Background(), updatedMember, activity.ID); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to post activity to inbox").SetInternal(err)
}
}
@@ -232,7 +234,7 @@ func (s *Server) ComposeMemberRelationship(ctx context.Context, member *api.Memb
}
// Post member activity to owner inbox
-func (s *Server) PostInboxMemberActivity(ctx context.Context, member *api.Member, activity_id int, level api.InboxLevel) error {
+func (s *Server) PostInboxMemberActivity(ctx context.Context, member *api.Member, activity_id int) error {
role := api.Owner
memberFind := &api.MemberFind{
Role: &role,
@@ -246,7 +248,6 @@ func (s *Server) PostInboxMemberActivity(ctx context.Context, member *api.Member
inboxCreate := &api.InboxCreate{
ReceiverId: member.PrincipalId,
ActivityId: activity_id,
- Level: level,
}
_, err := s.InboxService.CreateInbox(context.Background(), inboxCreate)
if err != nil {
diff --git a/server/task.go b/server/task.go
index c883e4dba9..531df11537 100644
--- a/server/task.go
+++ b/server/task.go
@@ -210,11 +210,16 @@ func (s *Server) ChangeTaskStatusWithPatch(ctx context.Context, task *api.Task,
return nil, fmt.Errorf("failed to marshal activity after changing the task status: %v, err: %w", task.Name, err)
}
+ level := api.ACTIVITY_INFO
+ if updatedTask.Status == api.TaskFailed {
+ level = api.ACTIVITY_ERROR
+ }
activityCreate := &api.ActivityCreate{
CreatorId: taskStatusPatch.UpdaterId,
ContainerId: issue.ID,
Type: api.ActivityPipelineTaskStatusUpdate,
Comment: taskStatusPatch.Comment,
+ Level: level,
Payload: string(payload),
}
activity, err := s.ActivityService.CreateActivity(ctx, activityCreate)
@@ -224,7 +229,7 @@ func (s *Server) ChangeTaskStatusWithPatch(ctx context.Context, task *api.Task,
// To reduce noise, for now we only post status update to inbox upon task failure.
if updatedTask.Status == api.TaskFailed {
- if err := s.PostInboxIssueActivity(context.Background(), issue, activity.ID, api.INBOX_ERROR); err != nil {
+ if err := s.PostInboxIssueActivity(context.Background(), issue, activity.ID); err != nil {
return nil, err
}
}
diff --git a/store/activity.go b/store/activity.go
index 3e22e1383c..61d1c6c4c6 100644
--- a/store/activity.go
+++ b/store/activity.go
@@ -133,16 +133,18 @@ func createActivity(ctx context.Context, tx *Tx, create *api.ActivityCreate) (*a
updater_id,
container_id,
`+"`type`,"+`
+ `+"`level`,"+`
comment,
payload
)
- VALUES (?, ?, ?, ?, ?, ?)
- RETURNING id, creator_id, created_ts, updater_id, updated_ts, container_id, `+"`type`, comment, payload"+`
+ VALUES (?, ?, ?, ?, ?, ?, ?)
+ RETURNING id, creator_id, created_ts, updater_id, updated_ts, container_id, `+"`type`, level, comment, payload"+`
`,
create.CreatorId,
create.CreatorId,
create.ContainerId,
create.Type,
+ create.Level,
create.Comment,
create.Payload,
)
@@ -162,6 +164,7 @@ func createActivity(ctx context.Context, tx *Tx, create *api.ActivityCreate) (*a
&activity.UpdatedTs,
&activity.ContainerId,
&activity.Type,
+ &activity.Level,
&activity.Comment,
&activity.Payload,
); err != nil {
@@ -190,6 +193,7 @@ func findActivityList(ctx context.Context, tx *Tx, find *api.ActivityFind) (_ []
updated_ts,
container_id,
`+"`type`,"+`
+ `+"`level`,"+`
comment,
payload
FROM activity
@@ -213,6 +217,7 @@ func findActivityList(ctx context.Context, tx *Tx, find *api.ActivityFind) (_ []
&activity.UpdatedTs,
&activity.ContainerId,
&activity.Type,
+ &activity.Level,
&activity.Comment,
&activity.Payload,
); err != nil {
@@ -243,7 +248,7 @@ func patchActivity(ctx context.Context, tx *Tx, patch *api.ActivityPatch) (*api.
UPDATE activity
SET `+strings.Join(set, ", ")+`
WHERE id = ?
- RETURNING id, creator_id, created_ts, updater_id, updated_ts, container_id, `+"`type`, comment, payload"+`
+ RETURNING id, creator_id, created_ts, updater_id, updated_ts, container_id, `+"`type`, level, comment, payload"+`
`,
args...,
)
@@ -262,6 +267,7 @@ func patchActivity(ctx context.Context, tx *Tx, patch *api.ActivityPatch) (*api.
&activity.UpdatedTs,
&activity.ContainerId,
&activity.Type,
+ &activity.Level,
&activity.Comment,
&activity.Payload,
); err != nil {
diff --git a/store/inbox.go b/store/inbox.go
index 2b716b1ad4..7cd732a418 100644
--- a/store/inbox.go
+++ b/store/inbox.go
@@ -134,7 +134,7 @@ func (s *InboxService) FindInboxSummary(ctx context.Context, principalId int) (*
if inboxSummary.HasUnread {
row2, err := tx.QueryContext(ctx, `
- SELECT EXISTS (SELECT 1 FROM inbox WHERE receiver_id = ? AND status = 'UNREAD' AND level = 'ERROR')
+ SELECT EXISTS (SELECT 1 FROM inbox, activity WHERE inbox.receiver_id = ? AND inbox.status = 'UNREAD' AND inbox.activity_id = activity.id AND activity.level = 'ERROR')
`,
principalId,
)
@@ -164,15 +164,13 @@ func (s *InboxService) createInbox(ctx context.Context, tx *Tx, create *api.Inbo
INSERT INTO inbox (
receiver_id,
activity_id,
- `+"`status`,"+`
- `+"`level`"+`
+ `+"`status`"+`
)
- VALUES (?, ?, 'UNREAD', ?)
- RETURNING id, receiver_id, activity_id, `+"`status`, `level`"+`
+ VALUES (?, ?, 'UNREAD')
+ RETURNING id, receiver_id, activity_id, `+"`status`"+`
`,
create.ReceiverId,
create.ActivityId,
- create.Level,
)
if err != nil {
@@ -188,7 +186,6 @@ func (s *InboxService) createInbox(ctx context.Context, tx *Tx, create *api.Inbo
&inbox.ReceiverId,
&activityId,
&inbox.Status,
- &inbox.Level,
); err != nil {
return nil, FormatError(err)
}
@@ -223,7 +220,6 @@ func findInboxList(ctx context.Context, tx *Tx, find *api.InboxFind) (_ []*api.I
inbox.id,
receiver_id,
`+"`status`,"+`
- `+"`level`,"+`
activity.id,
activity.creator_id,
activity.created_ts,
@@ -231,6 +227,7 @@ func findInboxList(ctx context.Context, tx *Tx, find *api.InboxFind) (_ []*api.I
activity.updated_ts,
activity.container_id,
activity.type,
+ activity.level,
activity.comment,
activity.payload
FROM inbox, activity
@@ -252,7 +249,6 @@ func findInboxList(ctx context.Context, tx *Tx, find *api.InboxFind) (_ []*api.I
&inbox.ID,
&inbox.ReceiverId,
&inbox.Status,
- &inbox.Level,
&inbox.Activity.ID,
&inbox.Activity.CreatorId,
&inbox.Activity.CreatedTs,
@@ -260,6 +256,7 @@ func findInboxList(ctx context.Context, tx *Tx, find *api.InboxFind) (_ []*api.I
&inbox.Activity.UpdatedTs,
&inbox.Activity.ContainerId,
&inbox.Activity.Type,
+ &inbox.Activity.Level,
&inbox.Activity.Comment,
&inbox.Activity.Payload,
); err != nil {
@@ -286,7 +283,7 @@ func (s *InboxService) patchInbox(ctx context.Context, tx *Tx, patch *api.InboxP
UPDATE inbox
SET `+strings.Join(set, ", ")+`
WHERE id = ?
- RETURNING id, receiver_id, activity_id, `+"`status`, `level`"+`
+ RETURNING id, receiver_id, activity_id, `+"`status`"+`
`,
args...,
)
@@ -303,7 +300,6 @@ func (s *InboxService) patchInbox(ctx context.Context, tx *Tx, patch *api.InboxP
&inbox.ReceiverId,
&activityId,
&inbox.Status,
- &inbox.Level,
); err != nil {
return nil, FormatError(err)
}
diff --git a/store/migration/10001__init_schema.sql b/store/migration/10001__init_schema.sql
index 3849379bec..29601b54c7 100644
--- a/store/migration/10001__init_schema.sql
+++ b/store/migration/10001__init_schema.sql
@@ -791,6 +791,7 @@ CREATE TABLE activity (
updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),
container_id INTEGER NOT NULL CHECK (container_id != 0),
`type` TEXT NOT NULL CHECK (`type` LIKE 'bb.%'),
+ `level` TEXT NOT NULL CHECK (`level` IN ('INFO', 'WARNING', 'ERROR')),
`comment` TEXT NOT NULL DEFAULT '',
payload TEXT NOT NULL DEFAULT ''
);
@@ -826,8 +827,7 @@ CREATE TABLE inbox (
id INTEGER PRIMARY KEY AUTOINCREMENT,
receiver_id INTEGER NOT NULL REFERENCES principal (id),
activity_id INTEGER NOT NULL REFERENCES activity (id),
- `status` TEXT NOT NULL CHECK (`status` IN ('UNREAD', 'READ')),
- `level` TEXT NOT NULL CHECK (`level` IN ('INFO', 'WARNING', 'ERROR'))
+ `status` TEXT NOT NULL CHECK (`status` IN ('UNREAD', 'READ'))
);
CREATE INDEX idx_inbox_receiver_id_activity_id ON inbox(receiver_id, activity_id);
diff --git a/store/seed/test/10140__activity.sql b/store/seed/test/10140__activity.sql
index d1f6cac94d..2683ce6a56 100644
--- a/store/seed/test/10140__activity.sql
+++ b/store/seed/test/10140__activity.sql
@@ -6,6 +6,7 @@ INSERT INTO
updater_id,
container_id,
`type`,
+ `level`,
payload
)
VALUES
@@ -15,6 +16,7 @@ VALUES
1,
13001,
'bb.issue.create',
+ 'INFO',
'{"issueName":"Hello world!"}'
);
@@ -25,6 +27,7 @@ INSERT INTO
updater_id,
container_id,
`type`,
+ `level`,
`comment`,
payload
)
@@ -35,6 +38,7 @@ VALUES
101,
13001,
'bb.issue.comment.create',
+ 'INFO',
'Welcome!',
'{"issueName":"Hello world!"}'
);
@@ -46,6 +50,7 @@ INSERT INTO
updater_id,
container_id,
`type`,
+ `level`,
`comment`,
payload
)
@@ -56,6 +61,7 @@ VALUES
102,
13001,
'bb.issue.comment.create',
+ 'INFO',
'Let''s rock!',
'{"issueName":"Hello world!"}'
);
@@ -67,6 +73,7 @@ INSERT INTO
updater_id,
container_id,
`type`,
+ `level`,
`comment`,
payload
)
@@ -77,6 +84,7 @@ VALUES
103,
13001,
'bb.issue.comment.create',
+ 'INFO',
'Go fish!',
'{"issueName":"Hello world!"}'
);
@@ -91,6 +99,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
payload
)
VALUES
@@ -102,6 +111,7 @@ VALUES
1624873710,
13002,
'bb.issue.create',
+ 'INFO',
'{"issueName":"Create product table"}'
);
@@ -114,6 +124,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -126,6 +137,7 @@ VALUES
1624873710,
13002,
'bb.pipeline.task.status.update',
+ 'INFO',
'',
'{"taskId":11002,"oldStatus":"PENDING","newStatus":"RUNNING","issueName":"Create product table","taskName":"Add initial schema"}'
);
@@ -139,6 +151,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -151,6 +164,7 @@ VALUES
1624873710,
13002,
'bb.pipeline.task.status.update',
+ 'INFO',
'Established baseline version %s for database ''shop''',
'{"taskId":11002,"oldStatus":"RUNNING","newStatus":"DONE"}'
);
@@ -164,6 +178,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -176,6 +191,7 @@ VALUES
1624873710,
13002,
'bb.pipeline.task.status.update',
+ 'INFO',
'',
'{"taskId":11003,"oldStatus":"PENDING","newStatus":"RUNNING"}'
);
@@ -189,6 +205,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -201,6 +218,7 @@ VALUES
1624873710,
13002,
'bb.pipeline.task.status.update',
+ 'INFO',
'Established baseline version %s for database ''shop''',
'{"taskId":11003,"oldStatus":"RUNNING","newStatus":"DONE"}'
);
@@ -214,6 +232,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
payload
)
VALUES
@@ -225,6 +244,7 @@ VALUES
1624873710,
13002,
'bb.issue.field.update',
+ 'INFO',
'{"fieldId":"3","oldValue":"1","newValue":"101","issueName":"Create product table"}'
);
@@ -238,6 +258,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
payload
)
VALUES
@@ -249,6 +270,7 @@ VALUES
1624873710,
13003,
'bb.issue.create',
+ 'INFO',
'{"issueName":"CREATE a new TABLE ''tbl1''"}'
);
@@ -260,6 +282,7 @@ INSERT INTO
updater_id,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -270,6 +293,7 @@ VALUES
1,
13003,
'bb.pipeline.task.status.update',
+ 'ERROR',
'table "tbl1" already exists',
'{"taskId":11006,"oldStatus":"RUNNING","newStatus":"FAILED","issueName":"Create a new table ''tbl1''","taskName":"Update testdb_dev"}'
);
@@ -281,6 +305,7 @@ INSERT INTO
updater_id,
container_id,
`type`,
+ `level`,
payload
)
VALUES
@@ -290,6 +315,7 @@ VALUES
102,
13003,
'bb.issue.status.update',
+ 'INFO',
'{"oldStatus":"OPEN","newStatus":"CANCELED","issueName":"Create a new table ''tbl1''"}'
);
@@ -302,6 +328,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -313,6 +340,7 @@ VALUES
1624865387,
13004,
'bb.issue.create',
+ 'INFO',
'',
'{"issueName":"Create user, post, comment table for dev environment"}'
);
@@ -325,6 +353,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -336,6 +365,7 @@ VALUES
1624865388,
13004,
'bb.pipeline.task.status.update',
+ 'INFO',
'',
'{"taskId":11008,"oldStatus":"PENDING","newStatus":"RUNNING"}'
);
@@ -348,6 +378,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -359,6 +390,7 @@ VALUES
1624865388,
13004,
'bb.pipeline.task.status.update',
+ 'INFO',
'Established baseline version 202106280000 for database ''blog''',
'{"taskId":11008,"oldStatus":"RUNNING","newStatus":"DONE"}'
);
@@ -371,6 +403,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -382,6 +415,7 @@ VALUES
1624865388,
13004,
'bb.issue.status.update',
+ 'INFO',
'',
'{"oldStatus":"RUNNING","newStatus":"DONE","issueName":"Create user, post, comment table for dev environment"}'
);
@@ -395,6 +429,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -406,6 +441,7 @@ VALUES
1624866790,
13005,
'bb.issue.create',
+ 'INFO',
'',
'{"issueName":"Create user, post, comment table for integration environment"}'
);
@@ -418,6 +454,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -429,6 +466,7 @@ VALUES
1624866791,
13005,
'bb.pipeline.task.status.update',
+ 'INFO',
'',
'{"taskId":11009,"oldStatus":"PENDING","newStatus":"RUNNING"}'
);
@@ -441,6 +479,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -452,6 +491,7 @@ VALUES
1624866791,
13005,
'bb.pipeline.task.status.update',
+ 'INFO',
'Established baseline version 202106280000 for database ''blog''',
'{"taskId":11009,"oldStatus":"RUNNING","newStatus":"DONE"}'
);
@@ -464,6 +504,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -475,6 +516,7 @@ VALUES
1624866791,
13005,
'bb.issue.status.update',
+ 'INFO',
'',
'{"oldStatus":"RUNNING","newStatus":"DONE","issueName":"Create user, post, comment table for integration environment"}'
);
@@ -488,6 +530,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -499,6 +542,7 @@ VALUES
1624868407,
13006,
'bb.issue.create',
+ 'INFO',
'',
'{"issueName":"Create user, post, comment table for staging environment"}'
);
@@ -511,6 +555,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -522,6 +567,7 @@ VALUES
1624868408,
13006,
'bb.pipeline.task.status.update',
+ 'INFO',
'',
'{"taskId":11010,"oldStatus":"PENDING","newStatus":"RUNNING"}'
);
@@ -534,6 +580,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -545,6 +592,7 @@ VALUES
1624868408,
13006,
'bb.pipeline.task.status.update',
+ 'INFO',
'Established baseline version 202106280000 for database ''blog''',
'{"taskId":11010,"oldStatus":"RUNNING","newStatus":"DONE"}'
);
@@ -557,6 +605,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -568,6 +617,7 @@ VALUES
1624868408,
13006,
'bb.issue.status.update',
+ 'INFO',
'',
'{"oldStatus":"RUNNING","newStatus":"DONE","issueName":"Create user, post, comment table for staging environment"}'
);
@@ -581,6 +631,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -592,6 +643,7 @@ VALUES
1624868680,
13007,
'bb.issue.create',
+ 'INFO',
'',
'{"issueName":"Create user, post, comment table for prod environment"}'
);
@@ -604,6 +656,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -615,6 +668,7 @@ VALUES
1624868681,
13007,
'bb.pipeline.task.status.update',
+ 'INFO',
'',
'{"taskId":11011,"oldStatus":"PENDING","newStatus":"RUNNING"}'
);
@@ -627,6 +681,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -638,6 +693,7 @@ VALUES
1624868681,
13007,
'bb.pipeline.task.status.update',
+ 'INFO',
'Established baseline version 202106280000 for database ''blog''',
'{"taskId":11011,"oldStatus":"RUNNING","newStatus":"DONE"}'
);
@@ -650,6 +706,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -661,6 +718,7 @@ VALUES
1624868681,
13007,
'bb.issue.status.update',
+ 'INFO',
'',
'{"oldStatus":"RUNNING","newStatus":"DONE","issueName":"Create user, post, comment table for prod environment"}'
);
@@ -674,6 +732,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -685,6 +744,7 @@ VALUES
1624869944,
13008,
'bb.issue.create',
+ 'INFO',
'',
'{"issueName":"Add created_at column to user,post,comment table for dev environment"}'
);
@@ -697,6 +757,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -708,6 +769,7 @@ VALUES
1624869945,
13008,
'bb.pipeline.task.status.update',
+ 'INFO',
'',
'{"taskId":11012,"oldStatus":"PENDING","newStatus":"RUNNING"}'
);
@@ -720,6 +782,7 @@ INSERT INTO
updated_ts,
container_id,
`type`,
+ `level`,
COMMENT,
payload
)
@@ -731,6 +794,7 @@ VALUES
1624869945,
13008,
'bb.pipeline.task.status.update',
+ 'ERROR',
'database ''blog'' has already applied version 202106280100',
'{"taskId":11012,"oldStatus":"RUNNING","newStatus":"FAILED"}'
);
\ No newline at end of file
diff --git a/store/seed/test/10150__inbox.sql b/store/seed/test/10150__inbox.sql
index 3e94d95e94..28f2d29c47 100644
--- a/store/seed/test/10150__inbox.sql
+++ b/store/seed/test/10150__inbox.sql
@@ -4,196 +4,176 @@ INSERT INTO
id,
receiver_id,
activity_id,
- `status`,
- `level`
+ `status`
)
VALUES
(
15001,
101,
14001,
- 'READ',
- 'INFO'
+ 'READ'
);
INSERT INTO
inbox (
receiver_id,
activity_id,
- `status`,
- `level`
+ `status`
)
VALUES
- (101, 14003, 'UNREAD', 'INFO');
+ (101, 14003, 'UNREAD');
INSERT INTO
inbox (
receiver_id,
activity_id,
- `status`,
- `level`
+ `status`
)
VALUES
- (101, 14004, 'UNREAD', 'INFO');
+ (101, 14004, 'UNREAD');
INSERT INTO
inbox (
receiver_id,
activity_id,
- `status`,
- `level`
+ `status`
)
VALUES
- (101, 14005, 'UNREAD', 'INFO');
+ (101, 14005, 'UNREAD');
INSERT INTO
inbox (
receiver_id,
activity_id,
- `status`,
- `level`
+ `status`
)
VALUES
- (101, 14010, 'UNREAD', 'INFO');
+ (101, 14010, 'UNREAD');
INSERT INTO
inbox (
receiver_id,
activity_id,
- `status`,
- `level`
+ `status`
)
VALUES
- (101, 14012, 'UNREAD', 'ERROR');
+ (101, 14012, 'UNREAD');
INSERT INTO
inbox (
receiver_id,
activity_id,
- `status`,
- `level`
+ `status`
)
VALUES
- (101, 14013, 'UNREAD', 'INFO');
+ (101, 14013, 'UNREAD');
-- Inbox for receiver 102
INSERT INTO
inbox (
receiver_id,
activity_id,
- `status`,
- `level`
+ `status`
)
VALUES
- (102, 14001, 'READ', 'INFO');
+ (102, 14001, 'READ');
INSERT INTO
inbox (
receiver_id,
activity_id,
- `status`,
- `level`
+ `status`
)
VALUES
- (102, 14002, 'READ', 'INFO');
+ (102, 14002, 'READ');
INSERT INTO
inbox (
receiver_id,
activity_id,
- `status`,
- `level`
+ `status`
)
VALUES
- (102, 14004, 'READ', 'INFO');
+ (102, 14004, 'READ');
INSERT INTO
inbox (
receiver_id,
activity_id,
- `status`,
- `level`
+ `status`
)
VALUES
- (102, 14005, 'UNREAD', 'INFO');
+ (102, 14005, 'UNREAD');
INSERT INTO
inbox (
receiver_id,
activity_id,
- `status`,
- `level`
+ `status`
)
VALUES
- (102, 14006, 'UNREAD', 'INFO');
+ (102, 14006, 'UNREAD');
INSERT INTO
inbox (
receiver_id,
activity_id,
- `status`,
- `level`
+ `status`
)
VALUES
- (102, 14013, 'UNREAD', 'INFO');
+ (102, 14013, 'UNREAD');
-- Inbox for receiver 103
INSERT INTO
inbox (
receiver_id,
activity_id,
- `status`,
- `level`
+ `status`
)
VALUES
- (103, 14001, 'READ', 'INFO');
+ (103, 14001, 'READ');
INSERT INTO
inbox (
receiver_id,
activity_id,
- `status`,
- `level`
+ `status`
)
VALUES
- (103, 14002, 'READ', 'INFO');
+ (103, 14002, 'READ');
INSERT INTO
inbox (
receiver_id,
activity_id,
- `status`,
- `level`
+ `status`
)
VALUES
- (103, 14003, 'READ', 'INFO');
+ (103, 14003, 'READ');
INSERT INTO
inbox (
receiver_id,
activity_id,
- `status`,
- `level`
+ `status`
)
VALUES
- (103, 14005, 'READ', 'INFO');
+ (103, 14005, 'READ');
INSERT INTO
inbox (
receiver_id,
activity_id,
- `status`,
- `level`
+ `status`
)
VALUES
- (103, 14006, 'UNREAD', 'INFO');
+ (103, 14006, 'UNREAD');
INSERT INTO
inbox (
receiver_id,
activity_id,
- `status`,
- `level`
+ `status`
)
VALUES
- (103, 14013, 'UNREAD', 'INFO');
\ No newline at end of file
+ (103, 14013, 'UNREAD');
\ No newline at end of file