> For the complete documentation index, see [llms.txt](https://prisma-util.gitbook.io/stable/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://prisma-util.gitbook.io/stable/guides/migration/migrate-to-prisma-util-v2.0.md).

# Migrate to Prisma Util v2.0

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

<details>

<summary>Release Information</summary>

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

</details>

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:

<table><thead><tr><th width="116">Tag</th><th>Meaning</th></tr></thead><tbody><tr><td><strong>[F]</strong></td><td>This change is an extra <strong>non-experimental</strong> feature added to Prisma Util.</td></tr><tr><td><strong>[OF]</strong></td><td>This change is a featured added to Prisma Util that is marked as experimental.</td></tr><tr><td><strong>[OM]</strong></td><td>This change is an optional module.</td></tr><tr><td><strong>[FIX]</strong></td><td>This change is a bug-fix.</td></tr><tr><td><strong>[BACK]</strong></td><td>This change is an improvement for the Prisma Util backend.</td></tr><tr><td><strong>[DEP]</strong></td><td>This change is a deprecation in the API.</td></tr></tbody></table>

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

<table><thead><tr><th width="569">Change</th><th data-type="checkbox">Breaking Change</th></tr></thead><tbody><tr><td><strong>[OM] [F] [BACK]</strong> Introduced <a href="/stable/modules/project-toolchain.md">Project Toolchain</a>.</td><td>true</td></tr><tr><td><strong>[OM] [F]</strong> Introduced <a href="/stable/modules/schema-creator.md">Schema Creator</a>.</td><td>false</td></tr><tr><td><strong>[F]</strong> Introduced <a href="/stable/modules/core.md">core</a>.</td><td>false</td></tr><tr><td><strong>[F]</strong> Introduced Prisma.EnumName and PrismaClient.$unuse.</td><td>false</td></tr><tr><td><strong>[DEP]</strong> Deprecated <a href="/stable/optional-features/schema-improvements/pgtrgm-support.md">pg_trgm Support</a>.</td><td>true</td></tr><tr><td><strong>[OF]</strong> Introduced <a href="/stable/optional-features/cli-utilities/virtual-environment.md">Virtual Environments</a>.</td><td>false</td></tr><tr><td><strong>[OF]</strong> Introduced <a href="/stable/optional-features/cli-utilities/environment-lock.md">Environment Lock</a>.</td><td>false</td></tr><tr><td><strong>[OF]</strong> Introduced <a href="/stable/optional-features/runtime-modules/ignore-empty-conditions.md">Ignore Empty Conditions</a>.</td><td>false</td></tr><tr><td><strong>[OF]</strong> Introduced <a href="/stable/optional-features/runtime-modules/middleware-context.md">Middleware Context</a>.</td><td>false</td></tr><tr><td><strong>[OF]</strong> Introduced <a href="/stable/optional-features/runtime-modules/static-take.md">Static Take</a>.</td><td>false</td></tr><tr><td><strong>[OF]</strong> Introduced <a href="/stable/optional-features/schema-improvements/refined-types.md">Refined Types</a>.</td><td>false</td></tr><tr><td><strong>[OF]</strong> Introduced <a href="/stable/optional-features/schema-improvements/custom-attribute-functions.md">Custom Attribute Functions</a>.</td><td>false</td></tr><tr><td><strong>[OF]</strong> Introduced <a href="/stable/optional-features/schema-improvements/deprecated-tag.md">Deprecated Tag</a>.</td><td>false</td></tr><tr><td><strong>[OF]</strong> Introduced <a href="/stable/optional-features/schema-improvements/prisma-generators.md">Prisma Generators</a>.</td><td>false</td></tr><tr><td><strong>[OF]</strong> Introduced <a href="/stable/optional-features/cli-utilities/enhanced-introspection.md">Enhanced Introspection</a>.</td><td>false</td></tr><tr><td><strong>[BACK]</strong> Introduced "prisma-util" folder. This folder is configurable, because the path is saved inside of package.json ("prismaUtil").</td><td>true</td></tr><tr><td><strong>[DEP]</strong> Deprecated @prisma-util/schema-creator package.</td><td>true</td></tr><tr><td><strong>[F]</strong> Added constantGenerator, constantModel, env, execCommand, globModels, importType, useEnv to <a href="/stable/modules/schema-creator.md">schema-creator</a>.</td><td>false</td></tr><tr><td><strong>[F]</strong> Added --reset-only flag to <a href="/stable/api-documentation/command-reference/migrate-reset.md">prisma-util migrate reset</a>.</td><td>false</td></tr><tr><td><strong>[F]</strong> Added --schema parameter to <a href="/stable/api-documentation/command-reference/format.md">prisma-util format</a>.</td><td>false</td></tr><tr><td><strong>[DEP]</strong> Deprecated old way of enabling optional features and introduced <a href="/stable/api-documentation/configuration-reference/optional-features.md">optionalFeatures</a> array due to count.</td><td>true</td></tr></tbody></table>

## Migration Guide

Before starting, install the latest version of Prisma Util:

{% code title="Terminal" %}

```shell
npm install prisma-util@latest;
```

{% endcode %}

### 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:

{% code title="package.json" %}

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

{% endcode %}

#### 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:

{% code title="prisma-util/config.mjs" %}

```javascript
export default {
    // Your configuration
    optionalFeatures: ["crossFileRelations"] // Add an entry for each optional 
                                             // feature that you want to enable
}
```

{% endcode %}

### Introduced Project Toolchain

#### 1. Add the following lines to your configuration file:

{% code title="prisma-util/config.mjs" %}

```javascript
export default {
    // Your configuration
    toolchain: {
        useExtensions: false,
        resolve: {
            types: "./types"
        }
    }
}
```

{% endcode %}

#### 2. Create the prisma-util/types folder.

## Checking Migration

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