# Code generation

> **TL;DR**
> `File | Settings | Editor | Code Style | SQL | <sql_dialect> | Code generation` for Windows and Linux
>
>
>
> `IntelliJ IDEA | Settings | Editor | Code Style | SQL | <sql_dialect> | Code generation` for macOS
>
>
>
> `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) ![the Settings icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.settings.svg)
>
>
>
> As <sql_dialect>, select the SQL dialect on the [Code Style. SQL](settings-code-style-sql.html) 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 `Ctrl+Q` (Windows), `F1` (macOS), `⌃ J` (IntelliJ IDEA Classic (macOS)), `⌘ I` (macOS System Shortcuts), `Ctrl+Q` (XWin), `Ctrl+Q` (GNOME), `Ctrl+Q` (KDE), `Ctrl+Q` (Emacs), `Ctrl+Q` (Sublime Text), `Ctrl+Q` (Sublime Text (macOS)), `Ctrl+Q` (NetBeans), `Ctrl+K, I` (Visual Studio), `⌘ K, I` (Visual Studio (macOS)), `Alt+Middle-Click` (Eclipse), `⌥ Middle-Click` (Eclipse (macOS)).

`{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`.

## Set from...

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.

## See also

### Procedures

[Code style schemes](configuring-code-style.html)

