Code generation
File | Settings | Editor | Code Style | SQL | <sql_dialect> | Code generation for Windows and Linux
PyCharm | Settings | Editor | Code Style | SQL | <sql_dialect> | Code generation for macOS
CtrlAlt0S
As <sql_dialect>, select the SQL dialect on the Code Style. SQL page.
Use this page to configure formatting options for SQL files. When you change these settings, the Preview pane shows how this will affect your code.
Configure behavior of code generation for indexes, primary and foreign keys.
The tab contains templates for the names of primary and foreign key constraints, and indexes. These templates are used to generate default names for the constraints and indexes when you create them in the Create Table or the Modify Table dialog.
The templates can contain variables and text. When you generate a name, the specified text is reproduced literally. For example, when you apply the {table}_pk
template in the actor
table, the generated name of the primary key will be actor_pk
.
To see information about variables and their usage, click a field and press Ctrl0Q.
{unique?u:}
checks if the index is unique and inserts the corresponding sequence of characters. If the index is unique, the template generates a name with the sequence of characters specified between ?
and :
. For the {unique?u:}
template, it is u
. If the index is not unique, the sequence between :
and }
is inserted. For the {unique?u:}
template, it is nothing.
Example
You have the persons
table with columns FirstName
and LastName
. The {table}_{columns}_{unique?u:}index
template generates the following name for the not unique index: persons_FirstName_LastName_index
.
Click this link to reveal the list of languages to be used as the base for the current language code style. Only the settings that are applicable to the current language are taken. All the other settings are not affected.
This link appears in the upper-right corner of the language-specific code style page, when applicable.
Click Reset to discard changes and return to the initial set of code style settings.
Thanks for your feedback!