Skip to content

[WIP] πŸ—ƒοΈ feat(database): add workspace support schema and migration#15414

Closed
rdmclin2 wants to merge 2 commits into
canaryfrom
feat/support-workspace-db
Closed

[WIP] πŸ—ƒοΈ feat(database): add workspace support schema and migration#15414
rdmclin2 wants to merge 2 commits into
canaryfrom
feat/support-workspace-db

Conversation

@rdmclin2

@rdmclin2 rdmclin2 commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Extract the database layer of the workspace feature: workspace tables, workspace_id columns across existing tables, the 0105_add_workspace_support migration (+ snapshot/journal), and the regenerated database-schema.dbml.

πŸ’» Change Type

  • ✨ feat
  • πŸ› fix
  • ♻️ refactor
  • πŸ’„ style
  • πŸ‘· build
  • ⚑️ perf
  • βœ… test
  • πŸ“ docs
  • πŸ”¨ chore

πŸ”— Related Issue

πŸ”€ Description of Change

πŸ§ͺ How to Test

  • Tested locally
  • Added/updated tests
  • No tests needed

πŸ“Έ Screenshots / Videos

Before After
... ...

πŸ“ Additional Information

@vercel

vercel Bot commented Jun 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lobehub Error Error Jun 3, 2026 3:25am

Request Review

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @rdmclin2, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. feature:team-workspace Team workspace application labels Jun 2, 2026
@codecov

codecov Bot commented Jun 2, 2026

Copy link
Copy Markdown

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 69.88%. Comparing base (2eb9e34) to head (7a0f869).

Additional details and impacted files
@@            Coverage Diff             @@
##           canary   #15414      +/-   ##
==========================================
- Coverage   71.02%   69.88%   -1.14%     
==========================================
  Files        3212     3139      -73     
  Lines      321285   305146   -16139     
  Branches    29240    26340    -2900     
==========================================
- Hits       228179   213251   -14928     
+ Misses      92931    91720    -1211     
  Partials      175      175              
Flag Coverage Ξ”
app 61.84% <ΓΈ> (ΓΈ)
database ?
packages/agent-runtime 80.48% <ΓΈ> (ΓΈ)
packages/builtin-tool-lobe-agent 18.52% <ΓΈ> (ΓΈ)
packages/context-engine 84.17% <ΓΈ> (ΓΈ)
packages/conversation-flow 91.29% <ΓΈ> (ΓΈ)
packages/file-loaders 87.89% <ΓΈ> (ΓΈ)
packages/memory-user-memory 74.99% <ΓΈ> (ΓΈ)
packages/model-bank 99.99% <ΓΈ> (ΓΈ)
packages/model-runtime 84.72% <ΓΈ> (ΓΈ)
packages/prompts 72.49% <ΓΈ> (ΓΈ)
packages/python-interpreter 92.90% <ΓΈ> (ΓΈ)
packages/ssrf-safe-fetch 0.00% <ΓΈ> (ΓΈ)
packages/types 35.36% <ΓΈ> (ΓΈ)
packages/utils 88.69% <ΓΈ> (ΓΈ)
packages/web-crawler 88.08% <ΓΈ> (ΓΈ)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Ξ”
Store 68.43% <ΓΈ> (ΓΈ)
Services 54.58% <ΓΈ> (ΓΈ)
Server 72.32% <ΓΈ> (ΓΈ)
Libs 57.01% <ΓΈ> (ΓΈ)
Utils 81.44% <ΓΈ> (ΓΈ)
πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread packages/database/src/schemas/workspace.ts
Comment thread packages/database/src/schemas/workspace.ts
Comment thread packages/database/src/schemas/workspace.ts
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rdmclin2 rdmclin2 force-pushed the feat/support-workspace-db branch from 4fba540 to 8d7f0ca Compare June 3, 2026 03:12
arvinxx added a commit that referenced this pull request Jun 3, 2026
Bring over only the standalone `workspace.ts` schema from #15414 β€” the
workspaces / workspace_members / workspace_invitations / workspace_audit_logs
tables (self-contained, FK to users only). None of #15414's workspaceId
column additions across other tables are included. Migration is 0108-safe,
renumbered to 0107.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
arvinxx added a commit that referenced this pull request Jun 3, 2026
Bring over only the standalone `workspace.ts` schema from #15414 β€” the
workspaces / workspace_members / workspace_invitations / workspace_audit_logs
tables (self-contained, FK to users only). None of #15414's workspaceId
column additions across other tables are included. Migration is 0108-safe,
renumbered to 0107.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
arvinxx added a commit that referenced this pull request Jun 3, 2026
* ✨ feat(db): add usage column to messages table

Promote token usage/cost out of `metadata.usage` into a dedicated
`messages.usage` jsonb column, with btree expression indexes on
`usage.cost` and `usage.totalTokens`. Additive only β€” no data backfill;
`metadata.usage` stays the source of truth during the transition.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* ✨ feat(db): add agent share schema (picked from #15430)

Bring the agent-share schema layer over from #15430: new `agent_shares`
table + `topics.sender_id` column/index, schema relations and barrel
export. Migration renumbered to 0106 to sit after the usage column.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* ✨ feat(db): add workspace schema (picked from #15414)

Bring over only the standalone `workspace.ts` schema from #15414 β€” the
workspaces / workspace_members / workspace_invitations / workspace_audit_logs
tables (self-contained, FK to users only). None of #15414's workspaceId
column additions across other tables are included. Migration is 0108-safe,
renumbered to 0107.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* πŸ—ƒοΈ chore(db): squash usage/agent-share/workspace into one migration

Collapse the three stacked migrations (0105 usage, 0106 agent_share,
0107 workspace) into a single idempotent 0105_add_usage_agent_share_workspace.
Schema source is unchanged; only the migration files/snapshot/journal are
consolidated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* βœ… test(db): add senderId to expected topic shape in create test

The picked agent-share schema added topics.senderId, so the created row
now returns it; update the two toEqual assertions accordingly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@arvinxx arvinxx closed this Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature:team-workspace Team workspace application size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants