Toad World® Forums

Alter table scripts not possible to add to VCS

Hi,

a long time not altering tables, I now had to make some alterings to tables. I make my own scripts for alter tables (in this case adding columns). So I started the file with " ALTER TABLE XXX …" and at that same moment the option to add a file to VCS is disabled. If I put some other statement before it (Alter view or even a Select), it is enabled again. Why is this restricted? Is it possible to fix this

Herald

If your table (or any object in your script) is part of a controlled Schema in the DB, then “add to VCS” will be disabled. In this case, when you run the script, you will be prompted to check out the object, script runs, then you can check back in.

If your script contains 0 objects that are controlled by Team Coding in the DB then “add to VCS” should be enabled as Toad is recognizing this as a file that you might want to directly add to your VCS system.

From: herald.ten.dam [mailto:bounce-heraldtendam@toadworld.com]

Sent: Wednesday, July 20, 2016 6:03 AM

To: toadoraclebeta@toadworld.com

Subject: [Toad for Oracle - Beta Discussion Forum] Alter table scripts not possible to add to VCS

Alter table scripts not possible to add to VCS

Thread created by herald.ten.dam

Hi,

a long time not altering tables, I now had to make some alterings to tables. I make my own scripts for alter tables (in this case adding columns). So I started the file with " ALTER TABLE XXX …" and at that same moment the option to add a file to VCS is disabled. If I put some other statement before it (Alter view or even a Select), it is enabled again. Why is this restricted? Is it possible to fix this

Herald

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or
Unsubscribe from Toad for Oracle - Beta Forum
notifications altogether.

Toad for Oracle - Beta Discussion Forum

Flag
this post as spam/abuse.

Hi Brad,

this is not quite correct. I had script like this:

Alter table xxx …

alter table yyy…

This will disable the button.

If I add a " select sysdate from dual" at the top, the button is enabled, although the script has still the alter statements. I can even add “alter trigger xxx_br disable” at the top and the button is enabled. All triggers are controlled by TC btw. So the check for objects looks not fully solid.

Is it possible to make an option if you want to enable/disable this option. I need to make these scripts, because I use 1 schema for this, and can’t make diffs with other schema to show the differences. And 1 button in Toad is nicer than going to GIT for an ADD/COMMIT action.

Another option which I would prefer is that the content of the script put in VCS for a table isn’t the same as the script generated in the schema browser (the most preferred script on checkin would be the diff between current vcs and the database, but that will be a very hard 1 :wink: ). These are now related, if I forget for example the Drop option, then I get also the drop in VCS and that is not always nice for a release (the script will stop, or a table is deleted in another environment). Now I have to check everytime before making the releases form the vcs.

Thanks

Herald

The developer, John and I discussed this before 12.9 was released and could not really come up with an ideal way to handle this case, so this is very good feedback.

Our goals is to make this as straight forward as possible as to not cause confusion to users, as most users don’t use both VCS for scripts and Team Coding to control DB objects. Having a button for “Add to VCS” act on full files and “check out” work on DB objects that may be referenced in files can definitely cause confusion. In your case, however, I can definitely see where you would always want that button enabled. You are correct in that the enablement of that button is currently acting based off of caret position, or should be at least. If your caret is on a controlled object it should be disabled but when it’s not on a controlled object it, enabled. I was definitely incorrect with my last post. I get confused because we have gone through these scenarios so many times and have changed the behavior frequently.

I also understand your other point where you want to control DDL in scripts (VCS files). Toad can generate different DDL depending on your export DDL options. This was one of my biggest concerns when the decision was made to control tables/constraints/indexes in TC. I honestly can’t comprehend how using TC to version these objects could be managed, this is a big reason we wanted users to be able to manage scripts along side with controlled DB objects.

If we make this a little more solid with the current behavior will that work for you? If your caret is on that trigger and that trigger is controlled, that button should have been disabled. If you want to save this script just place your caret elsewhere to enable the button.

From: herald.ten.dam [mailto:bounce-heraldtendam@toadworld.com]

Sent: Wednesday, July 20, 2016 9:23 AM

To: toadoraclebeta@toadworld.com

Subject: RE: [Toad for Oracle - Beta Discussion Forum] Alter table scripts not possible to add to VCS

RE: Alter table scripts not possible to add to VCS

Reply by herald.ten.dam

Hi Brad,

this is not quite correct. I had script like this:

Alter table xxx …

alter table yyy…

This will disable the button.

If I add a " select sysdate from dual" at the top, the button is enabled, although the script has still the alter statements. I can even add “alter trigger xxx_br disable” at the top and the button is enabled. All triggers are controlled by TC btw. So the check for objects looks not fully solid.

Is it possible to make an option if you want to enable/disable this option. I need to make these scripts, because I use 1 schema for this, and can’t make diffs with other schema to show the differences. And 1 button in Toad is nicer than going to GIT for an ADD/COMMIT action.

Another option which I would prefer is that the content of the script put in VCS for a table isn’t the same as the script generated in the schema browser (the most preferred script on checkin would be the diff between current vcs and the database, but that will be a very hard 1 :wink: ). These are now related, if I forget for example the Drop option, then I get also the drop in VCS and that is not always nice for a release (the script will stop, or a table is deleted in another environment). Now I have to check everytime before making the releases form the vcs.

Thanks

Herald

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or
Unsubscribe from Toad for Oracle - Beta Forum
notifications altogether.

Toad for Oracle - Beta Discussion Forum

Flag
this post as spam/abuse.

I do see where “add file to VCS” is enabled for an alter trigger statement for a controlled trigger. I would think this is a bug. I see that the button is enabled for drops, but I think that is correct, since drops are usually only used in scripts maybe?

At any rate, I think you’ve got it right, just always enable it and not try to out-think the user. If you click it, the “add to vcs” dialog makes it very clear what is happening, the entire file is being added directly to your VCS system.

From: herald.ten.dam [mailto:bounce-heraldtendam@toadworld.com]

Sent: Wednesday, July 20, 2016 9:23 AM

To: toadoraclebeta@toadworld.com

Subject: RE: [Toad for Oracle - Beta Discussion Forum] Alter table scripts not possible to add to VCS

RE: Alter table scripts not possible to add to VCS

Reply by herald.ten.dam

Hi Brad,

this is not quite correct. I had script like this:

Alter table xxx …

alter table yyy…

This will disable the button.

If I add a " select sysdate from dual" at the top, the button is enabled, although the script has still the alter statements. I can even add “alter trigger xxx_br disable” at the top and the button is enabled. All triggers are controlled by TC btw. So the check for objects looks not fully solid.

Is it possible to make an option if you want to enable/disable this option. I need to make these scripts, because I use 1 schema for this, and can’t make diffs with other schema to show the differences. And 1 button in Toad is nicer than going to GIT for an ADD/COMMIT action.

Another option which I would prefer is that the content of the script put in VCS for a table isn’t the same as the script generated in the schema browser (the most preferred script on checkin would be the diff between current vcs and the database, but that will be a very hard 1 :wink: ). These are now related, if I forget for example the Drop option, then I get also the drop in VCS and that is not always nice for a release (the script will stop, or a table is deleted in another environment). Now I have to check everytime before making the releases form the vcs.

Thanks

Herald

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or
Unsubscribe from Toad for Oracle - Beta Forum
notifications altogether.

Toad for Oracle - Beta Discussion Forum

Flag
this post as spam/abuse.

Hi Brad,

maybe that’s the best, let the user decide :wink: Sometimes you can not automate everything. For me it will definitely work if a file can always be added to the VCS.

So thank you for your understanding.

Will next week work more on datamodelling and making scripts, so I can test TC and VCS control better

Thanks

Herald

John is looking into making this change now

From: herald.ten.dam [mailto:bounce-heraldtendam@toadworld.com]

Sent: Wednesday, July 20, 2016 11:35 AM

To: toadoraclebeta@toadworld.com

Subject: RE: [Toad for Oracle - Beta Discussion Forum] Alter table scripts not possible to add to VCS

RE: Alter table scripts not possible to add to VCS

Reply by herald.ten.dam

Hi Brad,

maybe that’s the best, let the user decide :wink: Sometimes you can not automate everything. For me it will definitely work if a file can always be added to the VCS.

So thank you for your understanding.

Will next week work more on datamodelling and making scripts, so I can test TC and VCS control better

Thanks

Herald

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or
Unsubscribe from Toad for Oracle - Beta Forum
notifications altogether.

Toad for Oracle - Beta Discussion Forum

Flag
this post as spam/abuse.

Hey Herald,

In Monday’s beta, the Add to VCS button will be enabled if the script has been saved to a file, and Team Coding will treat it as a script, rather than an object. Let us know if you run into any issues with it.

Thanks!,

-John