[英]IntelliJ IDEA does not recognise specific database schema in Javascript/Typescript files
At some point I was amazed when I managed to set the support of specific schema in my nodejs modules.在某些时候,当我设法在我的 nodejs 模块中设置对特定模式的支持时,我感到很惊讶。 Unfortunately, later IntelliJ IDEA decided to crash and I needed to remove my .idea folder, thus I lost all of my configurations.
不幸的是,后来 IntelliJ IDEA 决定崩溃,我需要删除我的 .idea 文件夹,因此我丢失了所有配置。 So, the problem is that when I write SQL queries it does not find tables or functions which exist in my database.
所以,问题是当我编写 SQL 查询时,它找不到我的数据库中存在的表或函数。 I have it connected in the DB view and can run queries, but I want autocompletion also for SQL queries in Javascript/Typescript files.
我已将它连接到数据库视图中并可以运行查询,但我还希望自动完成 Javascript/Typescript 文件中的 SQL 查询。
So, the question: how to tell to Intellij IDEA that it understands SQL queries for specific database schema in Javascript/Typescript files ?所以,问题是:如何告诉 Intellij IDEA 它理解针对 Javascript/Typescript 文件中特定数据库模式的 SQL 查询?
My tries:我的尝试:
The search_path environment variable in PostgreSQL specifies the order in which schemas are searched.
PostgreSQL 中的 search_path 环境变量指定搜索模式的顺序。 For example, you set the value of search_path to z,a,public, PostgreSQL will look for a value in the z schema.
例如,您将 search_path 的值设置为 z,a,public,PostgreSQL 将在 z 模式中查找值。 If nothing was not found in the z schema, PostgreSQL looks for the value in the a schema.
如果在 z 模式中未找到任何内容,PostgreSQL 将在 a 模式中查找值。
PostgreSQL is my case, thus I have tried to add the names of the schemas to search_path (that I have added to as a new property in Advanced tab for my database (maybe it is wrong place?)), but it didn't help. PostgreSQL 是我的情况,因此我尝试将模式的名称添加到 search_path(我已将其作为新属性添加到我的数据库的高级选项卡中(也许是错误的地方?)),但它没有帮助.
So, where it could be set?那么,它可以设置在哪里?
As Andrey mentioned in the comment, to resolve this, SQL Resolution Scopes must be configured.正如Andrey在评论中提到的,要解决这个问题,必须配置SQL 解析范围。 This configuration can be found from Settings => Languages & Frameworks => SQL Resolution Scopes.
可以从设置 => 语言和框架 => SQL 解析范围中找到此配置。
I do not know if this information will be able to help someone.我不知道这些信息是否能够帮助某人。
I had this problem in Intellij IDEA Database tab.我在 Intellij IDEA 数据库选项卡中遇到了这个问题。
I got the solution doing : Data Sources and Drivers -> YOUR_DATA_SOURCE -> Schemas -> Check "All databases"我得到了解决方案:数据源和驱动程序 -> YOUR_DATA_SOURCE -> Schemas -> 检查“所有数据库”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.