Issues with SQL Server constraints - resorted to SQL Management Studio in the end!

Hi,

I tried to use the refactor facility in DataGrip 2017.1.4 for the first time with a SQL Server 2012 database, and I have to say I was sorely disappointed... :(

I tried to rename a column, and I was asked if I wanted to Refactor or Preview. I tried Refactor... and it said I wasn't allowed due to the column taking part in enforced relationships. So I tried again and did Preview. It found an index and a foreign key. Great! I dropped those... and I tried the rename, and it failed again!

After a fair amount of digging, and after DataGrip reporting that the column was not in use anywhere... I found the column to be used in a constraint on the same table!

So I was a bit annoyed, and thought, "at least I have found it"... so I tried to right-click and go to Database Tools in order to find an option... and it was asking me to Drop Primary Key - for my constraint! I figured it was a typo, and selected the option anyway... and it showed me the SQL to drop my primary key!!!

Last resort, I right-clicked table and selected Modify Table. It shows ColumnsKeysIndices, and Foreign Keys... but my check constraint was on none of these tabs!

So I went to SQL Management Studio and deleted in there within 30 seconds...

1

Please sign in to leave a comment.