diff --git a/CHANGELOG.md b/CHANGELOG.md index b85c785..50dd658 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- Prisma no longer causes a crash when running on Windows ## [0.5.3] - 2022-02-01 ### Changed diff --git a/src/utils/create-database-url.ts b/src/utils/create-database-url.ts index becc973..d17789b 100644 --- a/src/utils/create-database-url.ts +++ b/src/utils/create-database-url.ts @@ -2,6 +2,14 @@ import {join} from 'path'; export const createDatabasePath = (directory: string) => join(directory, 'db.sqlite'); -const createDatabaseUrl = (directory: string) => `file:${createDatabasePath(directory)}`; +const createDatabaseUrl = (directory: string) => { + const url = `file:${createDatabasePath(directory)}`; + + if (process.platform === 'win32') { + return url.replaceAll(/\\/g, '\\\\'); + } + + return url; +}; export default createDatabaseUrl;