Skip to content

Prisma's names

Your code says Order.orderedAt. The database says orders.ordered_at. With a Prisma project’s repository linked to a database, pgjumbo shows the names your code uses beside the names the database has, wherever you meet a table or a column.

pgjumbo reads the names from schema.prisma itself: each model’s @@map, each field’s @map, and the /// descriptions. Nothing of Prisma runs. In a Query Tool, the status bar says where the names are from and when they were read, such as “Names from prisma/schema.prisma at 02:39 PM”. Point at it for the repository’s folder and how many of the models have a table in this database.

Suggestions, Quick Info and the hover over a column all gain Prisma’s name. Writing SQL has each of them in full.

The editor after typing c.is in a WHERE clause on customers: the suggestion list offers the column active, with isActive beside it, then boolean and the table's name.The editor after typing c.is in a WHERE clause on customers: the suggestion list offers the column active, with isActive beside it, then boolean and the table's name.
  • 1 A column’s Prisma field is shown beside it, between the column’s name and its type.

Typing the field’s name finds the column too: isActive finds active. The column’s own name is what goes into the SQL, since that is the name PostgreSQL knows.

Quick Info under the name customers in the editor: the table's kind, rows and size, then a line tagged Prisma with model Customer and its description, a line with its key and the model it relates to, and the table's columns.Quick Info under the name customers in the editor: the table's kind, rows and size, then a line tagged Prisma with model Customer and its description, a line with its key and the model it relates to, and the table's columns.
  • 1 Pointing at the name of a table or view that a model is mapped to also shows the model, tagged Prisma, with the description written over it in schema.prisma.
  • 2 The model’s key, and the models it relates to, written as the schema writes them: Order[] for a list, Coupon? for one that may be missing.
The hover under the column active in the editor: customers.active, boolean, and under it Prisma Customer.isActive, Boolean, with the field's description False once the account is closed.The hover under the column active in the editor: customers.active, boolean, and under it Prisma Customer.isActive, Boolean, with the field's description False once the account is closed.
  • 1 Pointing at a column shows the field it is, as Model.field, with the field’s Prisma type and its description.
A Query Tool with the rows of customers. Prisma names in headings is ticked in the result bar, and each heading has the Prisma field under the column's name: isActive under active, memberSince under since. The status bar says Names from prisma/schema.prisma.A Query Tool with the rows of customers. Prisma names in headings is ticked in the result bar, and each heading has the Prisma field under the column's name: isActive under active, memberSince under since. The status bar says Names from prisma/schema.prisma.
  • 1 Tick Prisma names in headings in the result bar to put each column’s field under its name.
  • 2 The column’s name stays on top, with the field under it. Pointing at a heading shows both, with the type.
  • 3 The status bar’s line on where the names are from.

A column of another model than most of the result’s is shown with its model, as Customer.fullName. An expression has no field, and neither has a column of a table without a model.

The box is offered only while the result in front has such columns, and only in the grid, not when the result shows as text, a chart or a map. The results grid has the rest of the result bar.

The box is the same choice as SettingsMigrationsNamesModel names beside tables and columns:

Choice Where the names show
Hover and autocomplete In suggestions, hovers, Quick Info, the Inspector and the ERD. pgjumbo starts with this. Unticking the box chooses it.
Also grid headings Under a result’s headings too. Ticking the box chooses it.
Nowhere Only the database’s own names, everywhere. The ERD’s Names switch still shows Prisma’s for one diagram.

Settings has the setting.

With a Prisma project linked, the diagram of a schema is drawn by Prisma’s names.

The ERD of shop's public schema drawn by Prisma's names: cards headed Customer, Order and Product with the tables' names under them, fields with Prisma types, a line from Order to Customer labelled customer and orders, and a dashed line between Product and Order.The ERD of shop's public schema drawn by Prisma's names: cards headed Customer, Order and Product with the tables' names under them, fields with Prisma types, a line from Order to Customer labelled customer and orders, and a dashed line between Product and Order.
  • 1 Names in the tab’s bar: Prisma or Database. It is there only when a Prisma project is linked. Database draws this diagram by the database’s own names again.
  • 2 Each card is headed by its model, with the table’s own name under it.
  • 3 The rows are fields, with their Prisma types and PK or FK.
  • 4 A list that holds no column here, such as items · OrderItem[], is a muted row after the fields.
  • 5 Each line carries the names of the two fields it relates.
  • 6 An implicit many-to-many relation is one dashed line between its two models, in place of the joining table Prisma keeps for it.
  • 7 The Legend gains a line for the dashed line.

With SettingsMigrationsNamesModel names beside tables and columns on Nowhere, a diagram opens by the database’s names, and Names › Prisma turns Prisma’s on for that diagram alone.

Select a table or view that a model is mapped to in the Explorer. The Inspector adds two blocks under its properties, on Summary.

The Inspector for the table orders: under View data, the block Prisma model shows model Order with its @@map, its file and line with the model's description, and a table of fields beside their columns. Under Migrations are the migration that created the table, the last one that changed it and a pending one.The Inspector for the table orders: under View data, the block Prisma model shows model Order with its @@map, its file and line with the model's description, and a table of fields beside their columns. Under Migrations are the migration that created the table, the last one that changed it and a pending one.
  • 1 Prisma model: how schema.prisma heads the model, with its @@map when the table has another name than the model.
  • 2 The file and the line the model is on, and its description.
  • 3 Each Field beside its Column. Point at a row for the field’s Prisma type and description.
  • 4 Migrations: Created is the migration that created the table, Last change the last applied one that changed it, and Pending each migration that waits, with what it will do.

Read again in the Inspector reads both again. A table’s whole history is in its History view: see Link a repository.

With a Prisma project linked, the Health check says three more things, each from the schema and each among the findings to look at.

Finding What it says
columns are filled by Prisma Client, not by the database, with their number The columns marked @updatedAt, and those whose default Prisma works out itself: cuid(), uuid(), nanoid() or ulid(). An INSERT or UPDATE written by hand, or by another app, must give them a value: the database has no default and no trigger for them. Each column is listed with what marks it.
An enum lost a value the data still uses A value an enum still has in the database that the schema no longer lists, while rows hold it. A migration that makes the enum again without the value fails on those rows. The finding names the enum, the value, the table and about how many rows.
foreign keys have no index, with their number The finding is there with or without Prisma. With a project linked it adds that Prisma does not index the columns of a relation on PostgreSQL: add @@index([…]) to the model and migrate, or build the index in a migration of its own.

The enum’s rows are read from the planner’s statistics, so nothing is scanned. A value that only a few rows hold may not be found.

When no column is filled by Prisma Client alone, the Health check says so among what is fine.

  • No Prisma project’s repository is linked to the database, or the linked folder has no schema.prisma.
  • SettingsMigrationsNamesModel names beside tables and columns is on Nowhere.
  • SettingsMigrationsFinding themFind migration tools in my databases is off. Then pgjumbo reads nothing of a migration tool, model names among it.
  • The table has no model. A table Prisma does not know keeps its own name alone.