-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
On table or column name change, rename contstraint names to match new name #3036
Comments
Hi @tsujp If you feel it is good to have an |
An edit button would be great there! |
@rakeshkky What if providing an option to automatic update, by users' intention and taking their own risk? |
@jjangga0214 |
@rakeshkky Thanks for the response. What if I have renamed so many tables? Then I would have to write a script, which will rename constraints by convention (using table name). So this is what I meant. I felt it can be convenient if there's a single option on console (or API) to auto-update constraints when a table is renamed. Of course, this does not mean Hasura should guarantee the result. I (user) have to make sure names of my constraints follow the convention, and Hasura will only handle them. I personally don't think this is in high priority, but I believe it's useful. How do you think? |
I came into an issue where I renamed a table to better fit the data that is in the table. Then I later realized that I wanted to restructure the data so I added another table (with the name of the table before it was renamed). I then tried adding a primary key on the table but it was saying the key already existed. So, I was not able to add a key to this table. I then figured out that the key was already in use in the renamed table so I deleted the key and re-added it so it would reflect the table. I was then able to add the key to the newly created table. Steps I took:
|
+1 on this feature request, it would also be nice to add a way to rename triggers for columns like |
Hey @TheColorRed, thanks for reporting the issue. This issue is there till |
Currently Hasura does not update constraint names when changing a table or column name.
Consider having an initial table called
clients
with anid
andemail
column,id
is the primary-key and biginit unique autoincrementing,email
is text and unique.Hasura will show the constraints on this table as the following:
Primary key
Unique keys
Now rename the table to
users
and the constraint names will not change.Perhaps they should be updated to keep semantic value, although it's not breaking anything so this is probably(?) a minor priority change.
Example SQL to tie into changes:
Also credit to elitan#8042 for suggestions relating to this issue.
The text was updated successfully, but these errors were encountered: