Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore: retire memo tags
Steven0c673d49eff6
diff --git a/server/router/api/v1/memo_service.go b/server/router/api/v1/memo_service.goindex c0ed80418..c3ec13945 100644--- a/server/router/api/v1/memo_service.go+++ b/server/router/api/v1/memo_service.go@@ -780,7 +780,6 @@ func (s *APIV1Service) convertMemoFromStore(ctx context.Context, memo *store.MemContent: memo.Content,Nodes: convertFromASTNodes(nodes),Visibility: convertVisibilityFromStore(memo.Visibility),- Tags: memo.Tags,Pinned: memo.Pinned,ParentId: memo.ParentID,Relations: listMemoRelationsResponse.Relations,diff --git a/store/db/mysql/memo.go b/store/db/mysql/memo.goindex 145e4baa8..51431ba3d 100644--- a/store/db/mysql/memo.go+++ b/store/db/mysql/memo.go@@ -2,7 +2,6 @@ package mysqlimport ("context"- "encoding/json""fmt""strings"@@ -16,14 +15,6 @@ import (func (d *DB) CreateMemo(ctx context.Context, create *store.Memo) (*store.Memo, error) {fields := []string{"`uid`", "`creator_id`", "`content`", "`visibility`", "`tags`", "`payload`"}placeholder := []string{"?", "?", "?", "?", "?", "?"}- tags := "[]"- if len(create.Tags) != 0 {- tagsBytes, err := json.Marshal(create.Tags)- if err != nil {- return nil, err- }- tags = string(tagsBytes)- }payload := "{}"if create.Payload != nil {payloadBytes, err := protojson.Marshal(create.Payload)@@ -32,7 +23,7 @@ func (d *DB) CreateMemo(ctx context.Context, create *store.Memo) (*store.Memo, e}payload = string(payloadBytes)}- args := []any{create.UID, create.CreatorID, create.Content, create.Visibility, tags, payload}+ args := []any{create.UID, create.CreatorID, create.Content, create.Visibility, "[]", payload}stmt := "INSERT INTO `memo` (" + strings.Join(fields, ", ") + ") VALUES (" + strings.Join(placeholder, ", ") + ")"result, err := d.db.ExecContext(ctx, stmt, args...)@@ -129,7 +120,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo"UNIX_TIMESTAMP(`memo`.`updated_ts`) AS `updated_ts`","`memo`.`row_status` AS `row_status`","`memo`.`visibility` AS `visibility`",- "`memo`.`tags` AS `tags`","`memo`.`payload` AS `payload`","IFNULL(`memo_organizer`.`pinned`, 0) AS `pinned`","`memo_relation`.`related_memo_id` AS `parent_id`",@@ -155,7 +145,7 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memolist := make([]*store.Memo, 0)for rows.Next() {var memo store.Memo- var tagsBytes, payloadBytes []byte+ var payloadBytes []bytedests := []any{&memo.ID,&memo.UID,@@ -164,7 +154,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo&memo.UpdatedTs,&memo.RowStatus,&memo.Visibility,- &tagsBytes,&payloadBytes,&memo.Pinned,&memo.ParentID,@@ -175,9 +164,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memoif err := rows.Scan(dests...); err != nil {return nil, err}- if err := json.Unmarshal(tagsBytes, &memo.Tags); err != nil {- return nil, errors.Wrap(err, "failed to unmarshal tags")- }payload := &storepb.MemoPayload{}if err := protojsonUnmarshaler.Unmarshal(payloadBytes, payload); err != nil {return nil, errors.Wrap(err, "failed to unmarshal payload")diff --git a/store/db/postgres/memo.go b/store/db/postgres/memo.goindex 6d15bb3b1..2ec9956d6 100644--- a/store/db/postgres/memo.go+++ b/store/db/postgres/memo.go@@ -2,7 +2,6 @@ package postgresimport ("context"- "encoding/json""fmt""strings"@@ -14,15 +13,7 @@ import ()func (d *DB) CreateMemo(ctx context.Context, create *store.Memo) (*store.Memo, error) {- fields := []string{"uid", "creator_id", "content", "visibility", "tags", "payload"}- tags := "[]"- if len(create.Tags) != 0 {- tagsBytes, err := json.Marshal(create.Tags)- if err != nil {- return nil, err- }- tags = string(tagsBytes)- }+ fields := []string{"uid", "creator_id", "content", "visibility", "payload"}payload := "{}"if create.Payload != nil {payloadBytes, err := protojson.Marshal(create.Payload)@@ -31,7 +22,7 @@ func (d *DB) CreateMemo(ctx context.Context, create *store.Memo) (*store.Memo, e}payload = string(payloadBytes)}- args := []any{create.UID, create.CreatorID, create.Content, create.Visibility, tags, payload}+ args := []any{create.UID, create.CreatorID, create.Content, create.Visibility, payload}stmt := "INSERT INTO memo (" + strings.Join(fields, ", ") + ") VALUES (" + placeholders(len(args)) + ") RETURNING id, created_ts, updated_ts, row_status"if err := d.db.QueryRowContext(ctx, stmt, args...).Scan(@@ -120,7 +111,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo`memo.updated_ts AS updated_ts`,`memo.row_status AS row_status`,`memo.visibility AS visibility`,- `memo.tags AS tags`,`memo.payload AS payload`,`COALESCE(memo_organizer.pinned, 0) AS pinned`,`memo_relation.related_memo_id AS parent_id`,@@ -151,7 +141,7 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memolist := make([]*store.Memo, 0)for rows.Next() {var memo store.Memo- var tagsBytes, payloadBytes []byte+ var payloadBytes []bytedests := []any{&memo.ID,&memo.UID,@@ -160,7 +150,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo&memo.UpdatedTs,&memo.RowStatus,&memo.Visibility,- &tagsBytes,&payloadBytes,&memo.Pinned,&memo.ParentID,@@ -171,9 +160,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memoif err := rows.Scan(dests...); err != nil {return nil, err}- if err := json.Unmarshal(tagsBytes, &memo.Tags); err != nil {- return nil, errors.Wrap(err, "failed to unmarshal tags")- }payload := &storepb.MemoPayload{}if err := protojsonUnmarshaler.Unmarshal(payloadBytes, payload); err != nil {return nil, errors.Wrap(err, "failed to unmarshal payload")diff --git a/store/db/sqlite/memo.go b/store/db/sqlite/memo.goindex a39e24ad2..a90418c17 100644--- a/store/db/sqlite/memo.go+++ b/store/db/sqlite/memo.go@@ -2,7 +2,6 @@ package sqliteimport ("context"- "encoding/json""fmt""strings"@@ -14,16 +13,8 @@ import ()func (d *DB) CreateMemo(ctx context.Context, create *store.Memo) (*store.Memo, error) {- fields := []string{"`uid`", "`creator_id`", "`content`", "`visibility`", "`tags`", "`payload`"}- placeholder := []string{"?", "?", "?", "?", "?", "?"}- tags := "[]"- if len(create.Tags) != 0 {- tagsBytes, err := json.Marshal(create.Tags)- if err != nil {- return nil, err- }- tags = string(tagsBytes)- }+ fields := []string{"`uid`", "`creator_id`", "`content`", "`visibility`", "`payload`"}+ placeholder := []string{"?", "?", "?", "?", "?"}payload := "{}"if create.Payload != nil {payloadBytes, err := protojson.Marshal(create.Payload)@@ -32,7 +23,7 @@ func (d *DB) CreateMemo(ctx context.Context, create *store.Memo) (*store.Memo, e}payload = string(payloadBytes)}- args := []any{create.UID, create.CreatorID, create.Content, create.Visibility, tags, payload}+ args := []any{create.UID, create.CreatorID, create.Content, create.Visibility, payload}stmt := "INSERT INTO `memo` (" + strings.Join(fields, ", ") + ") VALUES (" + strings.Join(placeholder, ", ") + ") RETURNING `id`, `created_ts`, `updated_ts`, `row_status`"if err := d.db.QueryRowContext(ctx, stmt, args...).Scan(@@ -121,7 +112,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo"`memo`.`updated_ts` AS `updated_ts`","`memo`.`row_status` AS `row_status`","`memo`.`visibility` AS `visibility`",- "`memo`.`tags` AS `tags`","`memo`.`payload` AS `payload`","IFNULL(`memo_organizer`.`pinned`, 0) AS `pinned`","`memo_relation`.`related_memo_id` AS `parent_id`",@@ -151,7 +141,7 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memolist := make([]*store.Memo, 0)for rows.Next() {var memo store.Memo- var tagsBytes, payloadBytes []byte+ var payloadBytes []bytedests := []any{&memo.ID,&memo.UID,@@ -160,7 +150,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo&memo.UpdatedTs,&memo.RowStatus,&memo.Visibility,- &tagsBytes,&payloadBytes,&memo.Pinned,&memo.ParentID,@@ -171,9 +160,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memoif err := rows.Scan(dests...); err != nil {return nil, err}- if err := json.Unmarshal(tagsBytes, &memo.Tags); err != nil {- return nil, errors.Wrap(err, "failed to unmarshal tags")- }payload := &storepb.MemoPayload{}if err := protojsonUnmarshaler.Unmarshal(payloadBytes, payload); err != nil {return nil, errors.Wrap(err, "failed to unmarshal payload")diff --git a/store/memo.go b/store/memo.goindex 32253e5e0..cabd96b55 100644--- a/store/memo.go+++ b/store/memo.go@@ -48,7 +48,6 @@ type Memo struct {// Domain specific fieldsContent stringVisibility Visibility- Tags []stringPayload *storepb.MemoPayload// Composed fields