简体   繁体   中英

PhpStorm - associate SQL schema with project source

PhpStorm reports Unresolved reference errors for SQL statements in source code editor:

Unable to resolve column expiry_time

Inspection info: This inspection performs unresolved SQL references check

There is a MySQL schema file for the project, but I can't find how to associate this schema file with the project source.

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.

See this page for exact steps: https://www.jetbrains.com/help/phpstorm/connecting-to-a-database.html#create_ddl_data_source

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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