Repository navigation
Description
Part of an epic.
Introspection fundamentally reads the list of installed (relevant) extensions, and persists them in the Prisma schema.
Introspection maintains an allow-list of known relevant extensions. The extensions on the allow list are treated differently (see below). The reason for this is that many extensions are irrelevant to the Prisma Schema (e.g. more database-administration related extensions), and if introspection wrote all of them into introspected schemas, the extensions list would be very long when many extensions are installed. Since multi-line array literals in the PSL are not supported, this is a problem. Implementation-wise, the allow-list will be hard-coded in the introspection engine.
- On initial introspection, we will render the installed extensions we find and that are part of the allow-list in the extensions array in the datasource. We will not render the extensions property when no allow-listed extension is installed.
- In re-introspection, will act differently for allow-listed and non-allow-listed extensions:
- Allow-listed extensions
- are added if they are in the database but not in the Prisma schema.
- are kept if they are in the Prisma schema and in the database.
- are removed if they are in the Prisma schema but not the database.
- Non-allow-listed extensions
- are removed if they are in the Prisma schema but not the database.
- are kept if they are in the Prisma schema and in the database.
- Allow-listed extensions
The initial allow list: citext, postgis, pg_crypto, uuid-ossp.
No extensions should be visible in the introspected data model, if the preview feature postgresqlExtensions is not enabled.
It would be great if the sql-schema-describer part is done in a separate pull request, which then allows the introspection and migration work to be done in parallel.
Activity
test(db pull): postgresqlExtensions