Skip to content

[ENH] Add resource_name to SysDB tenants table #4730

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

drewkim
Copy link
Contributor

@drewkim drewkim commented Jun 3, 2025

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • None
  • New functionality
    • Adds a new TEXT field, resource_name, to tenants table on SysDB. This is a globally unique identifier for the tenant, so adds a unique index (when not null) as well. It is meant to be a human-readable identifier.
    • Updates both gRPC and SQLite SysDB

Test plan

How are these changes tested?

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Documentation Changes

Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs section?

Copy link

github-actions bot commented Jun 3, 2025

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

Copy link
Contributor Author

drewkim commented Jun 3, 2025

@drewkim drewkim marked this pull request as ready for review June 3, 2025 18:36
Copy link
Contributor

propel-code-bot bot commented Jun 3, 2025

Add resource_name Field to SysDB Tenants Table with Unique Index

This PR introduces a new, nullable TEXT field called resource_name to the tenants table in SysDB (Postgres-backed implementation), with a unique index enforced only when the value is not null. The change updates migration files, model definition, and adjusts related config for local development. It removes now-erroneous/duplicate migrations after resolving cross-backend concerns and syncs documentation to clarify the field is consistently named resource_name.

Key Changes:
• Adds nullable TEXT column resource_name to tenants table in SysDB via migration
• Creates a conditional unique index on resource_name when not null
• Updates GORM data model to include a pointer to ResourceName with correct indexing annotation
• Changes local development DB URL in atlas.hcl to add password for migrations
• Updates migration checksums and registry (atlas.sum)

Affected Areas:
• SysDB Postgres database schema (tenants table and migrations)
• Go SysDB model definitions
• Atlas schema management configuration

This summary was automatically generated by @propel-code-bot

@@ -12,7 +12,7 @@ data "external_schema" "gorm" {

env "dev" {
src = data.external_schema.gorm.url
dev = "postgres://localhost:5432/chroma?sslmode=disable"
dev = "postgres://chroma:chroma@localhost:5432/chroma?sslmode=disable"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Found that this was necessary to get the migration to run properly

@drewkim drewkim requested review from HammadB and codetheweb June 3, 2025 18:37
Copy link
Collaborator

@HammadB HammadB left a comment

Choose a reason for hiding this comment

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

Will setter methods to set this come after?

@drewkim
Copy link
Contributor Author

drewkim commented Jun 3, 2025

Will setter methods to set this come after?

@HammadB yes, wanted to keep this just to migration

@HammadB
Copy link
Collaborator

HammadB commented Jun 3, 2025

Will setter methods to set this come after?

@HammadB yes, wanted to keep this just to migration

Cool can we stack the rest of the change and merge them down together so we can make sure our changes all make sense together?

@drewkim drewkim changed the title [ENH] Add static_name to SysDB tenants table [ENH] Add resource_name to SysDB tenants table Jun 4, 2025
@drewkim drewkim force-pushed the drew/_enh_add_static_name_to_sysdb_tenants_table branch from 48caba8 to 67d8771 Compare June 4, 2025 05:16
@drewkim drewkim requested a review from sanketkedia June 4, 2025 05:32
@drewkim drewkim force-pushed the drew/_enh_add_static_name_to_sysdb_tenants_table branch 2 times, most recently from 1fff500 to e6f6417 Compare June 4, 2025 18:30
@drewkim
Copy link
Contributor Author

drewkim commented Jun 5, 2025

Note: in order to unblock this, we're no longer including the SQLite SysDB migration. After hours of debugging, the rust bindings prop test failure continues to elude. Will follow up with it. cc @codetheweb

@drewkim drewkim force-pushed the drew/_enh_add_static_name_to_sysdb_tenants_table branch from 6d6dd56 to 1fc07be Compare June 5, 2025 18:58
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