Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Cannot delete primary key #440

Open
wellingguzman opened this issue Sep 28, 2018 · 6 comments
Open

Cannot delete primary key #440

wellingguzman opened this issue Sep 28, 2018 · 6 comments
Labels
api bug Something isn't working wontfix This will not be worked on

Comments

@wellingguzman
Copy link
Contributor

The API allows you to create field with a primary key, but there's not way to delete the primary key. To delete a constraint in MySQL, it requires the name of the constraint.

@rijkvanzanten rijkvanzanten added the bug Something isn't working label Nov 7, 2018
@stale
Copy link

stale bot commented Jan 7, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@benhaynes
Copy link
Member

@wellingguzman — what do we need to add/track so that we know the constraint and can delete it?

@wellingguzman
Copy link
Contributor Author

We need to find the name of the key in INFORMATION_SCHEMA database (on MySQL).

This is a start, but we need to make sure the key is not a compound key before dropping it.

Also dropping constraint doesn't work for MySQL on Zend DB. Read here: zendframework/zend-db#36

@benhaynes
Copy link
Member

So we get the constraint name, make sure it's not a compound key... but can we still delete it if there's that Zend issue?

@wellingguzman

@wellingguzman
Copy link
Contributor Author

Dropping constraint doesn't work on Zend DB. I am not aware if there's a workaround. If we want to support we either create a workaround in Zend DB or Directus itself.

@benhaynes
Copy link
Member

To be honest, I don't really see this as a critical bug right now. Every collection needs a PK and won't function without one. We can't rename fields since the column name is referenced throughout settings/relationships.

We are currently beholden to ZendDB, which doesn't support this and isn't really getting many updates these days. So we don't have a lot of options.

We're not at a point where Directus is a full database admin tool yet, so I think we'll just need to live with this. If we port the API to Node this issue should go away. I'll downgrade this to High priority for now... and will add the wont fix tag until someone has a proper solution.

@benhaynes benhaynes added the wontfix This will not be worked on label Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants