Skip to content

feat(preferences): add scope columns migration and constants#1361

Merged
whoAbhishekSah merged 3 commits intomainfrom
feat/preference-scope-migration
Feb 3, 2026
Merged

feat(preferences): add scope columns migration and constants#1361
whoAbhishekSah merged 3 commits intomainfrom
feat/preference-scope-migration

Conversation

@whoAbhishekSah
Copy link
Member

@whoAbhishekSah whoAbhishekSah commented Jan 30, 2026

Summary

Adds database schema for org-scoped user preferences feature.

Migration adds:

  • scope_type - references namespaces table, defaults to app/platform
  • scope_id - text field, defaults to zero UUID (00000000-0000-0000-0000-000000000000)
  • Updated unique constraint: uq_preferences_resource_scope

Design decisions:

  • Uses zero values instead of NULL for PostgreSQL 14 compatibility
  • Existing preferences automatically get global scope via defaults

Part of: #1347

Test plan

  • Migration applies cleanly on fresh DB
  • Migration applies on DB with existing preferences
  • Rollback migration works

🤖 Generated with Claude Code

Add database migration for org-scoped user preferences:
- scope_type: references namespaces, defaults to 'app/platform'
- scope_id: text field, defaults to zero UUID
- Uses zero values instead of NULL for PostgreSQL 14 compatibility
- Updates unique constraint to include scope columns

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Jan 30, 2026

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

Project Deployment Actions Updated (UTC)
frontier Ready Ready Preview, Comment Feb 3, 2026 8:39am

@coveralls
Copy link

coveralls commented Jan 30, 2026

Pull Request Test Coverage Report for Build 21623059426

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 20 (0.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 37.867%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/store/postgres/preference.go 0 9 0.0%
internal/store/postgres/preference_repository.go 0 11 0.0%
Totals Coverage Status
Change from base Build 21478939325: -0.02%
Covered Lines: 15887
Relevant Lines: 41955

💛 - Coveralls

Add ScopeType and ScopeID fields to both domain and postgres models
to handle the new database columns. Transform function converts zero
values back to empty strings for the API layer.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update the Set method to include scope_type and scope_id columns in
the INSERT and ON CONFLICT clause to match the new unique constraint
(resource_type, resource_id, scope_type, scope_id, name).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@whoAbhishekSah whoAbhishekSah merged commit 3105a66 into main Feb 3, 2026
7 checks passed
@whoAbhishekSah whoAbhishekSah deleted the feat/preference-scope-migration branch February 3, 2026 09:06
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.

3 participants