-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Prevent deleting mounted folders (#2036)
resolves #776 - The mount lookup happens only when we **"delete"** vfolders, not when we **"delete-forever"** them since it is already disallowed to delete-forever the READY vfolders - Apply [GIN index](https://www.postgresql.org/docs/current/datatype-json.html#JSON-INDEXING) to `sessions.vfolder_mounts` column **Checklist:** (if applicable) - [x] Milestone metadata specifying the target backport version - [x] Mention to the original issue - [x] API server-client counterparts (e.g., manager API -> client SDK) - [ ] Test case(s) to: - Demonstrate the difference of before/after - Demonstrate the flow of abstract/conceptual models with a concrete implementation - [ ] Documentation - Contents in the `docs` directory - docstrings in public interfaces and type annotations
- Loading branch information
Showing
5 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Prevent deleting mounted folders. |
29 changes: 29 additions & 0 deletions
29
...backend/manager/models/alembic/versions/31463788c713_add_index_sessions_vfolder_mounts.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""add_index_sessions_vfolder_mounts | ||
Revision ID: 31463788c713 | ||
Revises: dddf9be580f5 | ||
Create Date: 2024-04-19 18:53:29.903113 | ||
""" | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "31463788c713" | ||
down_revision = "dddf9be580f5" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.create_index( | ||
"ix_sessions_vfolder_mounts", | ||
"sessions", | ||
["vfolder_mounts"], | ||
unique=False, | ||
postgresql_using="gin", | ||
) | ||
|
||
|
||
def downgrade(): | ||
op.drop_index("ix_sessions_vfolder_mounts", table_name="sessions", postgresql_using="gin") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters