Fix Prisma path on Windows? (#499)

This commit is contained in:
Max Isom 2022-02-01 19:54:30 -06:00 committed by GitHub
parent 1b2781fe6a
commit 76dd6dd027
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View file

@ -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

View file

@ -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;