PhpStorm 2016.3 Help

Database Tool Window

View | Tool Windows | Database


On this page:

See also, Working with the Database Tool Window.

Overview of the tool window

The Database tool window provides access to functions for working with databases and DDL data sources. It lets you view and modify data structures in your databases, and perform other associated tasks.

/help/img/idea/2016.3/DBToolWindow.png

The available data sources are shown as a tree of data sources, schemas, tables and columns. If no data sources are currently defined, use the New command (Alt+Insert) to create a data source.

Most of the functions in this window are accessed by means of the toolbar icons or context menu commands. (If the toolbar is not currently shown, click /help/img/idea/2016.3/viewMode.png on the title bar and select Show Toolbar.) Many of the commands have keyboard shortcuts. If the toolbar is hidden, the Synchronize and Open Console commands can be access by means of the title bar icons (/help/img/idea/2016.3/SynchronizeOnTitleBar.png and /help/img/idea/2016.3/ConsoleOnTitleBar.png respectively).

/help/img/idea/2016.3/viewMode.png on the title bar provides access to view options.

Toolbar icons, context menu commands and shortcuts

IconCommandShortcutDescriptionAvailable for
/help/img/idea/2016.3/icon_collapse_all_on_title_bar.png Use this icon on the title bar to collapse all the nodes. All node types
imgNewAlt+Insert Use this icon, command or shortcut to create a new data source, database console, table, column, index, or a primary or foreign key. The list of options depends on which element is currently selected.

See also, Creating a data source, Data Sources and Drivers Dialog, Creating and opening a new database console, and Creating a table, a column, an index, or a primary or foreign key.

DB data sources and their elements. If a DDL data source is selected, you can only choose to create another data source.
imgDuplicateCtrl+D Use this icon, command or shortcut to create a copy of the selected data source. Specify the properties of the data source in the Data Sources and Drivers dialog that opens. See Data Sources and Drivers Dialog.DB and DDL data source nodes
imgSynchronizeCtrl+Alt+YUse this icon, command or shortcut to update the view of the selected element (i.e. to synchronize the view of the element with its actual state in the database).

See also, Auto sync.

DB data sources and their elements
/help/img/idea/2016.3/iconManageDataSources.png Properties Use this icon or command to open the Data Sources and Drivers dialog to manage your data sources and their settings. All node types
/help/img/idea/2016.3/stop.gifDisconnectCtrl+F2 Use this icon, command or shortcut to close the database connection for the selected DB data source or data sources. (The names of the data sources with active database connections are shown in bold.) DB data sources with active connections and their elements
/help/img/idea/2016.3/DataTables.png Table EditorF4Use this icon, command or shortcut to open the selected database table in the Table Editor.

See also, Working with the Table Editor.

Tables and table columns in DB data sources
/help/img/idea/2016.3/DataTables.png View Editor,
Routine Editor,
Package Editor
F4Use this icon, command or shortcut to open the definition of the selected view, function, procedure or package in the editor.Corresponding elements in DB data sources
/help/img/idea/2016.3/DataTables.pngEdit SourceF4Use this icon, command or shortcut to open the associated DDL file in the editor.Tables and table columns in DDL data sources
/help/img/idea/2016.3/runJdbcConsole.pngOpen ConsoleCtrl+Shift+F10 Use this icon, command or shortcut to open the default database console for the corresponding DB data source.DB data sources and their elements (tables and table columns)
Drop Associated Use the Drop Associated | Primary Key command to remove primary key constraints. Tables and columns in DB data sources
RenameShift+F6 Use this command or shortcut to rename the selected data source, table or table column. Specify the new name in the dialog that opens.

See also, Renaming a table or column.

All node types
Modify Table,
Modify Column,
Modify Index,
Modify Foreign Key
Ctrl+F6Use this command or shortcut to edit the definition of the selected table, column, index or foreign key.

See also, Modifying the definition of a table, column, index or a foreign key.

Corresponding elements in DB data sources
Copy ReferenceCtrl+Shift+Alt+CUse this command or shortcut to copy the fully qualified name of the selected data source, table or table column to the clipboard.All node types
Drop or RemoveDeleteUse this command or shortcut to remove the selected item.All node types
Hide Use this command to hide the selected schemas. See Showing and hiding schemas. Schemas in DB data sources
Find UsagesAlt+F7 Use this command or shortcut 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
CompareCtrl+DSelect two data sources, schemas or tables and then use this command or shortcut to compare table structures for the selected items. The comparison results are shown in the differences viewer.DB and DDL data sources and tables
Open New Console Use this command to create and open a new database console for the corresponding DB data source.DB data sources and their elements (tables and table columns)
Forget Schemas Use this command in problematic cases such as when your data structures start to display incorrectly, fail to synchronize, etc. As a result, PhpStorm deletes the information it has accumulated about your database.

To check if this has eliminated the problem, use the Synchronize command.

DB data sources
Import from File Use this command to import a text file containing delimiter-separated values (CSV, TSV, etc.) into your database.

If a schema is currently selected, PhpStorm will create a new table for the data that you are importing. If a table is selected, PhpStorm will try to add the data to the selected table.

See Importing delimiter-separated values into a database.

Schemas, tables and columns in DB data sources. For columns, the result will be the same as for schemas
Copy DDLCtrl+Shift+CUse this command or shortcut to copy a DDL definition of the selected data source, table or column onto the clipboard.All node types
Dump Data to File Use this command to save the data for the selected table or view in a file, or to view or edit the settings for delimiter-separated values output formats. Select the output format or Configure CSV Formats. In the latter case, the CSV Formats Dialog will open and you'll be able to edit the settings for existing formats, and define new output formats.Tables in DB data sources
Color Settings Use this command if you want to set or change the color for the selected element or elements. (The Database Color Settings dialog will open.)All node types
DiagramsCtrl+Shift+Alt+U
Ctrl+Alt+U
Use this command or shortcut 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 Use this key combination to see basic information about the selected element. For example, the info about a table includes the names of the data source, catalog, schema and the table itself, the table definition (CREATE TABLE) and, if appropriate, the first 10 rows.

To close the documentation pop-up, press Escape.

You can also access this function from the main menu: View | Quick Documentation.

All node types

View options

The view options, generally, define what is shown in the tool window and how. To view or change these options, click /help/img/idea/2016.3/viewMode.png on the title bar.

Option Description
Group Schema This option defines how schema elements are shown.

When on, there are separate nodes for tables, views and stored routines (shown as folders). Tables, views and routines (procedures and functions) are shown as elements of the corresponding groups.

/help/img/idea/2016.3/DBGroupSchemaOn.png

When off, there is no explicit grouping for tables, views, and routines. Tables and views are followed by procedures and functions.

/help/img/idea/2016.3/DBGroupSchemaOff.png
Group Contents This option defines how table elements are shown.

When on, there are separate nodes for columns, indexes, primary and foreign key constraints, and triggers (shown as folders). The elements appear in the corresponding groups.

/help/img/idea/2016.3/DBGroupContentsOn.png

When off, there is no such grouping and, generally, only columns are shown for tables.

/help/img/idea/2016.3/DBGroupContentsOff.png
Show Keys and etc. When this option is on, the public and foreign key constraints, and indexes are shown as separate elements.
/help/img/idea/2016.3/DBShowTableConstraintsOn.png

Otherwise, there are no separate elements for the keys and indexes.

/help/img/idea/2016.3/DBShowTableConstraintsOff.png

The option is unavailable when the Group Contents option is on.

Show Empty Groups If the Group Schema or the Group Contents option is on, you can select to show or hide empty groups, i.e. the categories that contain no elements.

The Show Empty Groups option is on:

/help/img/idea/2016.3/DBShowEmptyGroupsOn.png

The Show Empty Groups option is off:

/help/img/idea/2016.3/DBShowEmptyGroupsOff.png
Sort Alphabetically When this option is off, columns, generally, are unsorted.
/help/img/idea/2016.3/DBSortColumnsOff.png

When this option is on, the columns are ordered alphabetically.

/help/img/idea/2016.3/DBSortColumnsOn.png
Show Toolbar Select or deselect this option to show or hide the toolbar.

The rest of the options are common for all the tool windows, see Viewing Modes.

Icons for data sources and their elements

IconDescription
/help/img/idea/2016.3/DataSource.png DB data source. Also, DBMS-specific icons are used:

/help/img/idea/2016.3/DBDB2.png DB2

/help/img/idea/2016.3/DBDerby.png Derby

/help/img/idea/2016.3/DBH2.png H2

/help/img/idea/2016.3/DBHSQLDB.png HSQLDB

/help/img/idea/2016.3/DBMySQL.png MySQL

/help/img/idea/2016.3/DBOracle.png Oracle

/help/img/idea/2016.3/DBPostgresql.png PostgreSQL

/help/img/idea/2016.3/DBSQLServer.png SQL Server

/help/img/idea/2016.3/DBSQLite.png SQLite

/help/img/idea/2016.3/DBSybase.png Sybase

/help/img/idea/2016.3/DBReadonly.png DB data source with the read-only status, e.g. /help/img/idea/2016.3/DBReadonlyDB2.png for DB2.
/help/img/idea/2016.3/icon_DDLDataSource.png DDL data source
/help/img/idea/2016.3/dataSchema.png Schema
/help/img/idea/2016.3/DataTables.png Table
/help/img/idea/2016.3/dataView.png View
/help/img/idea/2016.3/dataColumn.png Column
/help/img/idea/2016.3/dataColumnNotNull.png A NOT NULL column
dataPkColumn.png Column with a primary key
dataFkColumn.png Column with a foreign key
dataIndexedColumn.png Column with an index
/help/img/idea/2016.3/dataPrimaryKey.png Primary key
/help/img/idea/2016.3/dataForeignKey.png Foreign key
/help/img/idea/2016.3/dataIndex.png Index
/help/img/idea/2016.3/dataFunction.png Stored procedure or function

See Also

Getting Started:

Language and Framework-Specific Guidelines:

Last modified: 1 December 2016