Skip to content
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

fix: Refactor topology models to include tenant_id in keys. #3923

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

Conversation

VladimirFilonov
Copy link
Contributor

This update introduces "tenant_id" as a required field in all topology models and relationships, ensuring multi-tenancy support. Updated tests, services, and migrations to align with the changes, and added appropriate primary and foreign key constraints for consistency.

Closes #3898

📑 Description

✅ Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

ℹ Additional Information

Copy link

vercel bot commented Mar 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
keep ❌ Failed (Inspect) Mar 18, 2025 11:11am

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Mar 7, 2025
@VladimirFilonov VladimirFilonov force-pushed the fix/3898-bug-topology-models-pks-are-tenant-agnostic branch from 8d26ce1 to 9b51c3d Compare March 7, 2025 16:18
@VladimirFilonov VladimirFilonov force-pushed the fix/3898-bug-topology-models-pks-are-tenant-agnostic branch from c4ed400 to f64a25a Compare March 12, 2025 07:53
@VladimirFilonov VladimirFilonov force-pushed the fix/3898-bug-topology-models-pks-are-tenant-agnostic branch from b49917e to 3c0fb4e Compare March 12, 2025 12:57
Matvey-Kuk
Matvey-Kuk previously approved these changes Mar 12, 2025
@Matvey-Kuk Matvey-Kuk marked this pull request as draft March 12, 2025 13:26
@VladimirFilonov VladimirFilonov force-pushed the fix/3898-bug-topology-models-pks-are-tenant-agnostic branch from cd2e425 to c3ba242 Compare March 13, 2025 07:14
@VladimirFilonov VladimirFilonov force-pushed the fix/3898-bug-topology-models-pks-are-tenant-agnostic branch 2 times, most recently from e56dc89 to 9614950 Compare March 13, 2025 12:41
@VladimirFilonov VladimirFilonov marked this pull request as ready for review March 13, 2025 12:55
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. Architecture Requires an architecture change/review and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Mar 13, 2025
@VladimirFilonov VladimirFilonov force-pushed the fix/3898-bug-topology-models-pks-are-tenant-agnostic branch from 46ec09d to 5261448 Compare March 14, 2025 15:51
This update introduces "tenant_id" as a required field in all topology models and relationships, ensuring multi-tenancy support. Updated tests, services, and migrations to align with the changes, and added appropriate primary and foreign key constraints for consistency.
The unused `Integer` import was removed to clean up the code and ensure a more maintainable import structure. This change has no impact on functionality but improves code readability.
Temporary tables are renamed to backups to preserve data for potential future use. Comments are added to indicate eventual removal steps if these tables are no longer needed. This change ensures data safety during the interim period.
Corrects the `down_revision` field in the migration file to ensure proper dependency tracking in database migrations. This change resolves potential issues with migration sequencing.
Updated the topology models, migrations, and tests to replace integer-based IDs with UUIDs for better scalability and uniqueness. Introduced an `external_id` field where necessary to preserve compatibility with existing data. Adjusted related logic, schemas, and checks accordingly.
This change updates the test data with the `external_id` field to align with the expected structure. Ensures tests reflect real-world scenarios more accurately.
Updated e2e topology tests for improved node and edge selection logic. Refactored service ID and dependency parameters in type hints from `int` to `UUID | str` for consistency and clarity across various modules.
This commit introduces an empty migration file to merge two divergent database migration branches. It ensures compatibility and aligns the database schema history without making schema changes.
Cleaned up unused imports from the migration file to improve code readability and reduce unnecessary dependencies. This change has no impact on functionality but simplifies the codebase.
Extended wait times and retries in e2e tests to ensure stability and better error handling. Refactored edge creation logic to use dynamic node IDs, improving flexibility and accuracy. Removed primary key from `id` in topology schema to align with database requirements.
Updated migration script to modify parent dependencies and revision ID. Removed the old migration file and replaced it with a new one reflecting correct relationships. No functional changes were introduced.
Eliminated unnecessary imports to clean up the code and improve readability. This change has no functional impact and preserves the script's behavior.
Deleted an obsolete migration file with no operations. Adjusted the `down_revision` in an existing migration to reference the correct dependency, ensuring consistency in migration history.
The `raise` statement within the exception block was unnecessary, as the exception is already handled later in the code. This change improves clarity and avoids redundant code execution.
@VladimirFilonov VladimirFilonov force-pushed the fix/3898-bug-topology-models-pks-are-tenant-agnostic branch from 9104ecc to 076a115 Compare March 17, 2025 07:01
Copy link
Contributor

@Matvey-Kuk Matvey-Kuk left a comment

Choose a reason for hiding this comment

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

Scary one, relying on you testing it thoughtfully <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Architecture Requires an architecture change/review size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: Topology models PK's are tenant-agnostic
2 participants