# Migrate to Prisma Util v2.0

<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="../../modules/project-toolchain">Project Toolchain</a>.</td><td>true</td></tr><tr><td><strong>[OM] [F]</strong> Introduced <a href="../../modules/schema-creator">Schema Creator</a>.</td><td>false</td></tr><tr><td><strong>[F]</strong> Introduced <a href="../../modules/core">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="../../optional-features/schema-improvements/pgtrgm-support">pg_trgm Support</a>.</td><td>true</td></tr><tr><td><strong>[OF]</strong> Introduced <a href="../../optional-features/cli-utilities/virtual-environment">Virtual Environments</a>.</td><td>false</td></tr><tr><td><strong>[OF]</strong> Introduced <a href="../../optional-features/cli-utilities/environment-lock">Environment Lock</a>.</td><td>false</td></tr><tr><td><strong>[OF]</strong> Introduced <a href="../../optional-features/runtime-modules/ignore-empty-conditions">Ignore Empty Conditions</a>.</td><td>false</td></tr><tr><td><strong>[OF]</strong> Introduced <a href="../../optional-features/runtime-modules/middleware-context">Middleware Context</a>.</td><td>false</td></tr><tr><td><strong>[OF]</strong> Introduced <a href="../../optional-features/runtime-modules/static-take">Static Take</a>.</td><td>false</td></tr><tr><td><strong>[OF]</strong> Introduced <a href="../../optional-features/schema-improvements/refined-types">Refined Types</a>.</td><td>false</td></tr><tr><td><strong>[OF]</strong> Introduced <a href="../../optional-features/schema-improvements/custom-attribute-functions">Custom Attribute Functions</a>.</td><td>false</td></tr><tr><td><strong>[OF]</strong> Introduced <a href="../../optional-features/schema-improvements/deprecated-tag">Deprecated Tag</a>.</td><td>false</td></tr><tr><td><strong>[OF]</strong> Introduced <a href="../../optional-features/schema-improvements/prisma-generators">Prisma Generators</a>.</td><td>false</td></tr><tr><td><strong>[OF]</strong> Introduced <a href="../../optional-features/cli-utilities/enhanced-introspection">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="../../modules/schema-creator">schema-creator</a>.</td><td>false</td></tr><tr><td><strong>[F]</strong> Added --reset-only flag to <a href="../../api-documentation/command-reference/migrate-reset">prisma-util migrate reset</a>.</td><td>false</td></tr><tr><td><strong>[F]</strong> Added --schema parameter to <a href="../../api-documentation/command-reference/format">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="../../api-documentation/configuration-reference/optional-features">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.
