PyCharm
 
Get PyCharm
You are viewing the documentation for an earlier version of PyCharm.

Code generation

Last modified: 11 February 2024

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.