diff options
| author | Max Isom <[email protected]> | 2022-02-01 19:54:30 -0600 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-02-01 19:54:30 -0600 |
| commit | 76dd6dd02752cb1b09009c98c8993d2457ab280b (patch) | |
| tree | 28172526c90bf48a20930dbdd594ceae3d0af225 | |
| parent | 1b2781fe6ad0b089594f043aaea84f002451d712 (diff) | |
| download | muse-76dd6dd02752cb1b09009c98c8993d2457ab280b.tar.xz muse-76dd6dd02752cb1b09009c98c8993d2457ab280b.zip | |
Fix Prisma path on Windows? (#499)
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | src/utils/create-database-url.ts | 10 |
2 files changed, 11 insertions, 1 deletions
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; |
