@mikro-orm/knex 7.0.0-dev.77 → 7.0.0-dev.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,5 @@ import { AbstractSqlConnection } from '../../AbstractSqlConnection.js';
2
2
  export declare abstract class BaseSqliteConnection extends AbstractSqlConnection {
3
3
  connect(options?: {
4
4
  skipOnConnect?: boolean;
5
- simple?: boolean;
6
5
  }): Promise<void>;
7
6
  }
@@ -1,17 +1,8 @@
1
- import { dirname } from 'node:path';
2
1
  import { CompiledQuery } from 'kysely';
3
- import { Utils } from '@mikro-orm/core';
4
2
  import { AbstractSqlConnection } from '../../AbstractSqlConnection.js';
5
3
  export class BaseSqliteConnection extends AbstractSqlConnection {
6
4
  async connect(options) {
7
- await super.connect();
8
- if (options?.simple) {
9
- return;
10
- }
11
- const dbName = this.config.get('dbName');
12
- if (dbName && dbName !== ':memory:') {
13
- Utils.ensureDir(dirname(this.config.get('dbName')));
14
- }
5
+ await super.connect(options);
15
6
  await this.client.executeQuery(CompiledQuery.raw('pragma foreign_keys = on'));
16
7
  }
17
8
  }
@@ -1,5 +1,4 @@
1
1
  import { ConnectionException, ExceptionConverter, InvalidFieldNameException, LockWaitTimeoutException, NonUniqueFieldNameException, CheckConstraintViolationException, NotNullConstraintViolationException, ReadOnlyException, SyntaxErrorException, TableExistsException, TableNotFoundException, UniqueConstraintViolationException, ForeignKeyConstraintViolationException, } from '@mikro-orm/core';
2
- /* v8 ignore next */
3
2
  export class SqliteExceptionConverter extends ExceptionConverter {
4
3
  /**
5
4
  * @inheritDoc
@@ -7,6 +6,7 @@ export class SqliteExceptionConverter extends ExceptionConverter {
7
6
  * @see https://github.com/doctrine/dbal/blob/master/src/Driver/AbstractSQLiteDriver.php
8
7
  */
9
8
  convertException(exception) {
9
+ /* v8 ignore next */
10
10
  if (exception.message.includes('database is locked')) {
11
11
  return new LockWaitTimeoutException(exception);
12
12
  }
@@ -19,6 +19,7 @@ export class SqliteExceptionConverter extends ExceptionConverter {
19
19
  if (exception.message.includes('may not be NULL') || exception.message.includes('NOT NULL constraint failed')) {
20
20
  return new NotNullConstraintViolationException(exception);
21
21
  }
22
+ /* v8 ignore next */
22
23
  if (exception.message.includes('CHECK constraint failed')) {
23
24
  return new CheckConstraintViolationException(exception);
24
25
  }
@@ -37,9 +38,11 @@ export class SqliteExceptionConverter extends ExceptionConverter {
37
38
  if (exception.message.includes('syntax error')) {
38
39
  return new SyntaxErrorException(exception);
39
40
  }
41
+ /* v8 ignore next */
40
42
  if (exception.message.includes('attempt to write a readonly database')) {
41
43
  return new ReadOnlyException(exception);
42
44
  }
45
+ /* v8 ignore next */
43
46
  if (exception.message.includes('unable to open database file')) {
44
47
  return new ConnectionException(exception);
45
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/knex",
3
- "version": "7.0.0-dev.77",
3
+ "version": "7.0.0-dev.78",
4
4
  "description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -57,6 +57,6 @@
57
57
  "@mikro-orm/core": "^6.6.1"
58
58
  },
59
59
  "peerDependencies": {
60
- "@mikro-orm/core": "7.0.0-dev.77"
60
+ "@mikro-orm/core": "7.0.0-dev.78"
61
61
  }
62
62
  }