AM I getting the DDL source feature wrong, or is it buggy?
I have set up a DDL source mapping. Let's say the DB is A, and the DDL is B.
When I updated A → B, DataGrip created a subdirectory with the schema name. But in the DB Explorer, the name was ignored, and the schema was displayed like ‘schema#number’. This is not just a cosmetic problem, because if I edit just one SQL file and try to update B → A, DataGrip tries to drop all the tables in A, because in B, the tables in that schema do not exist (because the schema does not exist).
After a lot of trying, I have figured out that I could specify schema names for B in ‘New File Layout → Default schemas/databases’ but the behaviour seems unstable. That schema name is only applied if I open the SQL file and attach a data source. So, for example, if there are 1000 SQL files in B, and if I open one of them and attach a data source, in the DB explorer's DDL source, 999 entries are under ‘schema#1’ and 1 entry is under the schema name that I set in ‘New File Layout → Default schemas/databases’.
This makes updating B → A is almost unusable. I could manually uncheck all the wrong statements resulted from schema name mismatch but this seems very error-prone.
I have tried ‘Qualify objects with schema names: Always’, but this does not work either. It added the schema names to most objects, but not all. Some stored procedures and entries did not get the schema name and were placed under the ‘schema#1’ node anyway.
I just don't get why DataGrip cannot just use the subdirectory names as the schema. When updating A → B, it already correctly put all the objects in subdirectories according to the schema names, so why not just use that, instead of relying on the ‘New File Layout → Default schemas/databases’?
请先登录再写评论。
To answer your questions, this needs to be investigated first. To help us with the troubleshooting, please specify your current DataGrip version and a screenshot of your layout settings in DDL Data source properties.
We'll have a look