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

Drop schema contents when deleting #4251

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from
Open

Conversation

mathemancer
Copy link
Contributor

@mathemancer mathemancer commented Feb 12, 2025

Fixes #4240

Modifies the schemas.delete RPC function to drop all objects within passed schemas, and then the schemas themselves, without CASCADE.

Technical details

  • This is far safer than CASCADE, but lets users delete schemas that still contain objects
  • The new version of the function accepts an array of schema OIDs to drop.
    • This allows for future UIs where we allow a user to drop a set of schemas containing interdependent objects
  • The error messaging is greatly improved so that if a schema to be dropped contains dependencies of a schema which isn't to be dropped, all dependency issues will be shown.
  • I updated the scenario test so that it would have failed with the previous version.

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the develop branch of the repository
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no
    visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@mathemancer mathemancer changed the title Safer schema dropper Drop schema contents when deleting Feb 12, 2025
@mathemancer mathemancer added the pr-status: review A PR awaiting review label Feb 12, 2025
@mathemancer mathemancer added this to the v0.2.1 milestone Feb 12, 2025
@mathemancer mathemancer marked this pull request as ready for review February 12, 2025 03:46
@mathemancer
Copy link
Contributor Author

@pavish I made very tiny FE changes, so I assigned you to look at those.

.gitignore Outdated
@@ -186,6 +186,7 @@ node_modules/

# Client Build files
mathesar/static/mathesar/
static/
Copy link
Member

Choose a reason for hiding this comment

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

This will ignore any new files within /mathesar/static.

We have a number of icons and images here which are used in the product within /mathesar/static/non-code. We should be ignoring the exact path we need to ignore and not have a general static/ matcher here.

@@ -102,7 +102,7 @@ export class Schema {
return api.schemas
.delete({
database_id: this.database.id,
schema_oid: this.oid,
schema_oids: [this.oid],
Copy link
Member

Choose a reason for hiding this comment

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

Looks great.

@mathemancer mathemancer requested a review from pavish February 12, 2025 12:41
@mathemancer
Copy link
Contributor Author

@pavish This should be ready for re-review.

Copy link
Member

@pavish pavish left a comment

Choose a reason for hiding this comment

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

LGTM!

@pavish pavish removed their assignment Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-status: review A PR awaiting review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to delete schemas
3 participants