Toad World® Forums

Generate schema script, Constraints

Generate schema script tree result doesn't contain a "Constraints" name node, however Extract|Object types|Constraints is checked. All constraint scripts go under Table node, to the referenced table script.

  1. Can you separate the CREATE TABLE and ALTER TABLE ADD CONSTRAINT commands to an independent node/leaf in the tree? Create DDL script for selected tables always contains both the CREATE TABLE and ALTER TABLE ADD CONSTRAINT commands.

  2. Can you achieve that "Schema script Options|Constraints|Constraint locations" contains an extra option with Individual 'Alter table' command per Constraint names? This would extract the ALTER TABLE ADD CONSTRAINTS commands per constraint names.

Thanks for you replies.

  1. I could maybe make that an option. Not sure. Will have to investigate and get back to you.
  2. You already can choose from "Individual alter table commands" which should give you one 'alter table' for each constraint or "One big alter table command" which should give you one "alter table" for all constraints on the table. I don't understand what other possibility you are asking for. Could you provide an example of what you'd like the script to look like?

I would like an option that create one alter table statements for each constraints (like the second radio button does) but these generated statements should write to different files - every constraint has an own file, which name generated from the name of the constraint object.

According to the current operation maximum two files are generated under Constraint directory, one for foreign keys and an other file for NonFKs. If I have 3 foreign keys on the table, then Toad should generate 3 files under Constraint directory. Every file contains only its own constraint definition.

I understand now. Thanks for the clarification.