Skip to content

Support PostgreSQL Extensions in the Migration Engine #15629

Closed
prisma/prisma-engines
#3287

Description

@pimeys

Part of an epic.

Internal spec

The diffing of extensions is analogous to diffing of other schema elements (tables, enums, columns, etc.), but with the following important differences:

  • The migration engine will not issue DROP EXTENSION statements if an extension is installed but the corresponding declaration is missing.

  • It will use the IF NOT EXISTS option in order for the feature to be adopted smoothly, without breakage (the extension may already have been created manually by the user or database host).

  • CREATE EXTENSION missing extensions.

  • ALTER EXTENSION ... UPDATE TO ... to reach the necessary version, if a version argument was declared for the extension in the datasource.

  • ALTER EXTENSION ... SCHEMA ... to relocate extensions between schemas. For non-relocatable extensions, it will issue a DROP EXTENSION ... followed by a CREATE EXTENSION .....

None of the extension modifications can happen if the postgresqlExtensions preview feature is not enabled in the PSL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/featuretech/engines/migration enginetopic: postgresqltopic: postgresqlExtensions

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions