PhpStorm 6.0.1 Web Help

5.0+

View | Tool Windows | Database

View | Tool Windows | Database

Use the Database tool window to manage your data sources and perform associated tasks.

The available data sources are shown as a tree of data sources, tables and table columns. If no data sources are currently defined, use the New command (Alt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+Insert or Ctrl+NAlt+InsertControl N or Control EnterControl N or Control EnterMeta N or Control Enter) to create a data source.

Most of the functions in this window are accessed as context menu commands. Many of the commands have keyboard shortcuts. The Synchronize and Console commands can additionally be access by means of the title bar buttons (SynchronizeOnTitleBar and ConsoleOnTitleBar respectively).

The set of available functions depends, first of all, on the data source type (DB or DDL). For DB data sources you can, for example:

Irrespective of the data source type (DB or DDL), you can also:

On this page:

Context menu commands and shortcuts

IconCommandShortcutDescriptionAvailable for
imgNewAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+Insert or Ctrl+NAlt+InsertControl N or Control EnterControl N or Control EnterMeta N or Control Enter Use this command to create a new data source, table, table column, index, or primary or foreign key. The list of options depends on which element is currently selected.

If a data source is selected, or if there are no data sources currently defined and nothing is selected, you can choose:

  • DataTables Table to create a new table for a selected DB data source. (This option is not available unless there is at least one DB data source defined.)
  • DataSource Data Source to create a new DB data source. Specify the properties of the new data source in the Data Source Properties dialog.
  • icon_SqlDataSource DDL Data Source to create a new DDL data source. Specify the properties of the new data source in the Data Source Properties dialog.
  • icon_DataSourceImport.png Import from sources to create one or more DB data sources by importing the files that contain database connection settings (the database URL, driver class, user name and password).

    Select the files of interest (i.e. the data sources to be created) in the Import Data Sources dialog. (Prior to opening the dialog, PhpStorm will scan your project to find the appropriate files.)

If a table in a DB data source is selected, you can choose:

  • dataColumn Column to create a column in the selected table.
  • DataTables Table to create a table.

If a table column or a number of columns in a DB data sources is selected, you can choose:

  • dataColumn Column to create a column.
  • DataTables Table to create a table.
  • dataIndex Index to create an index on the selected column or columns.
  • dataPrimaryKey Primary Key to define a primary key constraint on the selected column or columns.
  • dataForeignKey Foreign Key to define a foreign key constraint on the selected column or columns.
DB data sources and their elements (tables and table columns). If a DDL data source is selected, you can only choose to create another data source.
stopClose ConnectionDeleteDeleteDeleteDeleteDelete or Ctrl+DDeleteDeleteDeleteDeleteDeleteDelete or BackspaceUse this command to close the selected active database connection (shown as database_connection underneath the corresponding DB data source node).Active connections
deleteDrop Associated Use this command to remove constraints such as a primary key or a foreign key constraint. Choose:
  • dataPrimaryKey Primary Key to remove the corresponding primary key constraint. The command is available for a table or any of its columns if the table has a primary key.
  • dataForeignKey Foreign Key to remove the corresponding foreign key constraint. The command is available only for a column or columns on which a foreign key constraint is defined.
Tables and table columns in DB data sources
RenameShift+F6Shift+F6Shift+F6Shift+F6Shift+F6Shift+F6Ctrl+RAlt+Shift+RShift F6Shift F6Shift F6 Use this command to rename the selected data source, table or table column. Specify the new name in the dialog that opens.All node types except active connections
imgDuplicateCtrl+DCtrl+DCtrl+DCtrl+DMeta+DCtrl+DCtrl+D, Ctrl+Shift+Down or Ctrl+Shift+UpCtrl+DMeta DMeta DMeta D Use this command to create a copy of the selected data source. Specify the properties of the data source in the Data Source Properties dialog that opens. See DB Data Source Properties or DDL Data Source Properties.DB and DDL data source nodes
Modify Column Ctrl+F6Ctrl+F6Ctrl+6Ctrl+F6Ctrl+F6Ctrl+F6Ctrl+F6Alt+Shift+CMeta F6Meta F6Meta Alt CUse this command to edit the properties of the selected column.Table columns in DB data sources
Copy ReferenceCtrl+Alt+Shift+CCtrl+Alt+Shift+CCtrl+Alt+Shift+CCtrl+Alt+Shift+CCtrl+Alt+Shift+CCtrl+Alt+Shift+CCtrl+Alt+Shift+CCtrl+Alt+Shift+CMeta Alt Shift CMeta Alt Shift CMeta Alt Shift CUse this command to copy the fully qualified name of the selected data source, table or table column to the clipboard.All node types except active connections
DeleteDeleteDeleteDeleteDeleteDelete or Ctrl+DDeleteDeleteDeleteDeleteDeleteDelete or BackspaceUse this command to delete the selected data source, table or table column.All node types except active connections
Find UsagesAlt+F7Alt+Shift+7Alt+Shift+7Alt+F7Alt+F7 or Alt+Shift+SAlt+Shift+F7Alt+F7Ctrl+GAlt F7Alt F7Meta Shift G Use this command to find the usages of (references to) the selected item (data source, table or table column) in the project source files and libraries. All node types except active connections
showAllPAthsAffectedCompareCtrl+DCtrl+DCtrl+DCtrl+DCtrl+DCtrl+DCtrl+DCtrl+DMeta DMeta DMeta DSelect two data sources or tables and then use this command to compare the selected items. The differences are shown in Differences Viewer for Folders and DB Objects.DB and DDL data sources and tables
DataTables Table EditorF4F4F4F4F4F4F4F12 or Ctrl+Shift+EF4F4F3Use this command to open the selected database table in the Table Editor.

See also, Manipulating Table Data in the Table Editor.

Tables and table columns in DB data sources
DataTables View Editor,
Function Editor,
Procedure Editor or
Package Editor
F4F4F4F4F4F4F4F12 or Ctrl+Shift+EF4F4F3Use this command to open the definition of the selected view, function, procedure or package in the editor.Corresponding elements in DB data sources
DataTablesEdit SourceF4F4F4F4F4F4F4F12 or Ctrl+Shift+EF4F4F3Use this command to open the associated DDL file in the editor.Tables and table columns in DDL data sources
runJdbcConsole.pngConsoleCtrl+Shift+F10Ctrl+Shift+F10Ctrl+Shift+F10Ctrl+Shift+F10Ctrl+Shift+F10Ctrl+F9Alt+Shift+F6 or Shift+F6Ctrl+Shift+F10Control Shift F10Control Shift F10Control Shift R Use this command to open the database console for the corresponding DB data source. As a result, you'll be able to run DDL and DML SQL statements to manipulate data structures and data.DB data sources and their elements (tables and table columns)
imgSynchronizeCtrl+Alt+YCtrl+Alt+YCtrl+Alt+YCtrl+Alt+YCtrl+Alt+YCtrl+Alt+YCtrl+Alt+YCtrl+Alt+YMeta Alt YMeta Alt YMeta Alt YUse this command to update the view of the selected element (i.e. to synchronize the view of the element with its actual state in the database).

Note that you can enable auto-synchronization for a DB data source by turning on the Auto sync option in the Data Source Properties dialog.

DB data sources and their elements (tables and table columns)
imgPropertiesEnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnterUse this command to view or edit the properties of the selected data source in the Data Source Properties dialog. See DB Data Source Properties or DDL Data Source Properties. DB and DDL data source nodes
DDLCopyCopy DDLCtrl+Shift+CCtrl+Shift+CCtrl+Shift+CCtrl+Shift+CCtrl+Shift+CCtrl+Shift+CCtrl+Shift+CCtrl+Shift+CMeta Shift CMeta Shift CMeta Shift CUse this command to copy a DDL definition of the selected data source, table or table column onto the clipboard.All node types except active connections
mainToolbarSaveSave to FileUse this command to save the selected table in a file, or to view or edit the export settings. Select:
  • Tab-separated Values (TSV) to save the table data in a text file in tab-separated values format.
  • Comma-separated Values (CSV) to save the table data in a text file in comma-separated values format.
  • HTML Table to save the data in an html file where the table is represented by the <table> element.
  • SQL Update Statements to save the data in a file where each row is represented by the corresponding UPDATE statement.
  • SQL Insert Statements to save the data in a file where each row is represented by the corresponding INSERT statement.
  • Export Settings to edit the data export settings. In the dialog that opens you can select whether you want the column names and row numbers to be included, and also specify how string values should be quoted in CSV and TSV files.
Tables in DB data sources
icon_UML.pngDiagramsNothingNothingNothingNothingNothingNothingNothingNothingNothingNothingNothing
NothingNothingNothingNothingNothingNothingNothingNothingNothingNothingNothing
Use this command to see a UML class diagram for the selected data source or table. Select:
  • Show Visualisation to open the diagram on a separate editor tab.
  • Show Visualisation Popup to see the diagram in a pop-up window.
DB and DDL data sources and tables
Ctrl+Q or Alt+Button2 ClickCtrl+Q or Alt+Button2 ClickCtrl+Q or Alt+Button2 ClickCtrl+Q or Alt+Button2 ClickCtrl+Q or Alt+Button2 ClickCtrl+Q or Shift+F1Ctrl+Q or Alt+Button2 ClickAlt+Button2 Click, Ctrl+Shift+Space or F2Control J or Control Button2 ClickControl J or Control Button2 ClickAlt Button2 Click or F2 Use this key combination to see basic information for the selected element. The information shown depends on the element type. For example, the following is shown for a table: the names of the data source, catalog, schema and the table itself. Also shown is the corresponding CREATE TABLE DDL statement and, if appropriate, the first 10 table rows.

To close the documentation pop-up, press EscapeEscapeEscapeEscapeEscape, Escape or Ctrl+GEscapeEscapeEscapeEscapeEscapeEscape.

All node types except active connections

Icons for data sources and their elements

IconDescription
DataSource DB data source
database_connection.png Database connection for a DB data source (appears right underneath the corresponding data source node as soon as the connection is established).

PhpStorm establishes a database connection automatically first time it needs to execute a query, and closes it automatically upon the session end. If necessary, a connection can be terminated manually, using the context menu command stop Close Connection.

icon_SqlDataSource DDL data source
dataSchema.png Schema
DataTables Table
dataColumn Column
dataColumnNotNull A NOT NULL column
dataPkColumn.png Column with a primary key
dataFkColumn.png Column with a foreign key
dataIndexedColumn.png Column with an index
dataPrimaryKey Primary key
dataForeignKey Foreign key
dataIndex Index
dataView View
dataFunction Stored procedure or function

See Also

Language and Framework-Specific Guidelines:

Getting Started:

Web Resources: