简体   繁体   English

PhpStorm - 将 SQL 架构与项目源相关联

[英]PhpStorm - associate SQL schema with project source

PhpStorm reports Unresolved reference errors for SQL statements in source code editor: PhpStorm 在源代码编辑器中报告 SQL 语句的未解决参考错误:

Unable to resolve column expiry_time无法解析列expiry_time

Inspection info: This inspection performs unresolved SQL references check检查信息:此检查执行未解决的 SQL 参考检查

There is a MySQL schema file for the project, but I can't find how to associate this schema file with the project source.该项目有一个 MySQL 架构文件,但我找不到如何将此架构文件与项目源相关联。

Clicking on the red lightbulb on the left hand side enables creating a new table but can't see how to import an existing table definition.单击左侧的红色灯泡可以创建新表,但看不到如何导入现有表定义。

You need to create a new Data Source in Database toolwindow and point to your database (be it dev version or maybe even a live one).您需要在数据库工具窗口中创建一个新的数据源并指向您的数据库(无论是开发版本还是实时版本)。

If using an actual database is not possible for whatever reason (specific environment requirements/restrictions or whatnot) but you have schema file, sill create a Data Source but point to your DDL/schema file instead.如果由于某种原因(特定环境要求/限制或诸如此类)无法使用实际数据库,但您有架构文件,则仍然创建一个数据源但指向您的 DDL/架构文件。

See this page for exact steps: https://www.jetbrains.com/help/phpstorm/connecting-to-a-database.html#create_ddl_data_source有关确切步骤,请参阅此页面: https://www.jetbrains.com/help/phpstorm/connecting-to-a-database.html#create_ddl_data_source

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM