Migrate to Prisma Util v2.0

Migration guide for Prisma Util v2.0.x from v1.3.x.

Release Information

API Version v2.0.0 has been released on the 5th of December 2022.

To migrate to Prisma Util v2.0, we're going to have to accommodate the following changes. The changelog table uses these conventions to differentiate between changes:

TagMeaning

[F]

This change is an extra non-experimental feature added to Prisma Util.

[OF]

This change is a featured added to Prisma Util that is marked as experimental.

[OM]

This change is an optional module.

[FIX]

This change is a bug-fix.

[BACK]

This change is an improvement for the Prisma Util backend.

[DEP]

This change is a deprecation in the API.

This table acts as the changelog for this version and will be referred as such during this guide:

ChangeBreaking Change

[OM] [F] [BACK] Introduced Project Toolchain.

[OM] [F] Introduced Schema Creator.

[F] Introduced core.

[F] Introduced Prisma.EnumName and PrismaClient.$unuse.

[DEP] Deprecated pg_trgm Support.

[OF] Introduced Virtual Environments.

[OF] Introduced Environment Lock.

[OF] Introduced Ignore Empty Conditions.

[OF] Introduced Middleware Context.

[OF] Introduced Static Take.

[OF] Introduced Refined Types.

[OF] Introduced Deprecated Tag.

[OF] Introduced Prisma Generators.

[OF] Introduced Enhanced Introspection.

[BACK] Introduced "prisma-util" folder. This folder is configurable, because the path is saved inside of package.json ("prismaUtil").

[DEP] Deprecated @prisma-util/schema-creator package.

[F] Added constantGenerator, constantModel, env, execCommand, globModels, importType, useEnv to schema-creator.

[F] Added --reset-only flag to prisma-util migrate reset.

[F] Added --schema parameter to prisma-util format.

[DEP] Deprecated old way of enabling optional features and introduced optionalFeatures array due to count.

Migration Guide

Before starting, install the latest version of Prisma Util:

Terminal
npm install prisma-util@latest;

Deprecated pg_trgm Support

Remove the configuration options of pg_trgm and all usages from your code.

Introduced "prisma-util" folder

1. Create a folder in your project root called prisma-util.

2. Go in your package.json and add the following lines:

package.json
{
    // your package.json
    "prismaUtil": "prisma-util"
}

3. Move your prisma-util.config.mjs file to prisma-util/config.mjs.

Deprecated @prisma-util/schema-creator package

Replace all @prisma-util/schema-creator imports with prisma-util/schema-creator.

Deprecated old way of enabling optional features

1. Remove all entries in your configuration file that are used to enable optional features

An example of such entry would be: crossFileRelations: true

2. Add the following lines to your configuration file:

prisma-util/config.mjs
export default {
    // Your configuration
    optionalFeatures: ["crossFileRelations"] // Add an entry for each optional 
                                             // feature that you want to enable
}

Introduced Project Toolchain

1. Add the following lines to your configuration file:

prisma-util/config.mjs
export default {
    // Your configuration
    toolchain: {
        useExtensions: false,
        resolve: {
            types: "./types"
        }
    }
}

2. Create the prisma-util/types folder.

Checking Migration

Run npx prisma-util schema to check if your migration has been successful.

Last updated