Skip to content

mig: add is_default flag to assistants#3124

Open
simplesagar wants to merge 1 commit into
claude/slack-session-8RFNNfrom
claude/age-2631-assistant-default-migration
Open

mig: add is_default flag to assistants#3124
simplesagar wants to merge 1 commit into
claude/slack-session-8RFNNfrom
claude/age-2631-assistant-default-migration

Conversation

@simplesagar
Copy link
Copy Markdown
Member

@simplesagar simplesagar commented Jun 1, 2026

Summary

Stacked on #3123. Migration only — first PR in the AGE-2631 stack (replace AI Insights with a per-(default-)project assistant).

Adds an is_default boolean to the assistants table plus a partial unique index so each project has at most one default (non-deleted) assistant. This marks the auto-provisioned assistant that will power the AI Insights sidebar; user-created assistants stay false.

ALTER TABLE assistants ADD COLUMN is_default boolean NOT NULL DEFAULT false;
CREATE UNIQUE INDEX CONCURRENTLY assistants_project_id_default_key
  ON assistants (project_id) WHERE (is_default AND deleted IS FALSE);

Safety

  • Additive only: NOT NULL DEFAULT false backfills existing rows in-place; no null window.
  • Index created CONCURRENTLY (-- atlas:txmode none) — no write lock on assistants.
  • Soft-deleted rows excluded from the partial index so a replaced default never collides with its tombstone.

Validation

  • mise lint:migrations: concurrent-index txmode ✅, ordering ✅
  • atlas migrate lint (against a clean pgvector dev DB): no findings ✅

Stack

  1. feat(dashboard): re-target AI Insights sidebar at project toolsets with RBAC #3123 — AI Insights → project toolsets + RBAC tokens (base)
  2. this PRis_default migration
  3. next — default-assistant provisioning + resolver
  4. nextdashboard ingress source kind + send endpoint
  5. next — egress platform tool + browser read path
  6. next — sidebar cutover

Ref: AGE-2631


Summary by cubic

Adds an is_default boolean to assistants and a partial unique index (excluding soft-deleted rows) to enforce at most one default assistant per project. Migration only; supports AGE-2631 by marking the auto-provisioned assistant for the AI Insights sidebar.

Written for commit 78970a8. Summary will update on new commits.

Review in cubic

Adds an `is_default` boolean to the `assistants` table plus a partial
unique index enforcing at most one default (non-deleted) assistant per
project. This marks the auto-provisioned assistant that will power the
AI Insights sidebar (AGE-2631); user-created assistants stay false.

Migration only — provisioning logic lands in a follow-up PR.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@simplesagar simplesagar requested a review from a team as a code owner June 1, 2026 00:46
@linear-code
Copy link
Copy Markdown

linear-code Bot commented Jun 1, 2026

AGE-2631

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 1, 2026

🦋 Changeset detected

Latest commit: 78970a8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
server Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

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

Project Deployment Actions Updated (UTC)
gram-docs-redirect Ready Ready Preview, Comment Jun 1, 2026 12:46am

Request Review

@simplesagar simplesagar changed the title feat(server): add is_default flag to assistants mig: add is_default flag to assistants Jun 1, 2026
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 4 files

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant