@mikro-orm/sql
Advanced tools
| import { SqliteDialect } from 'kysely'; | ||
| /** | ||
| * Kysely dialect for `node:sqlite` (Node.js 22.5+, Deno 2.2+). | ||
| * | ||
| * Bridges `node:sqlite`'s `DatabaseSync` to the `better-sqlite3` interface | ||
| * that Kysely's `SqliteDialect` expects. | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * import { SqliteDriver, NodeSqliteDialect } from '@mikro-orm/sql'; | ||
| * | ||
| * const orm = await MikroORM.init({ | ||
| * driver: SqliteDriver, | ||
| * dbName: ':memory:', | ||
| * driverOptions: new NodeSqliteDialect(':memory:'), | ||
| * }); | ||
| * ``` | ||
| */ | ||
| export declare class NodeSqliteDialect extends SqliteDialect { | ||
| constructor(dbName: string); | ||
| } |
| import { SqliteDialect } from 'kysely'; | ||
| /** | ||
| * Kysely dialect for `node:sqlite` (Node.js 22.5+, Deno 2.2+). | ||
| * | ||
| * Bridges `node:sqlite`'s `DatabaseSync` to the `better-sqlite3` interface | ||
| * that Kysely's `SqliteDialect` expects. | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * import { SqliteDriver, NodeSqliteDialect } from '@mikro-orm/sql'; | ||
| * | ||
| * const orm = await MikroORM.init({ | ||
| * driver: SqliteDriver, | ||
| * dbName: ':memory:', | ||
| * driverOptions: new NodeSqliteDialect(':memory:'), | ||
| * }); | ||
| * ``` | ||
| */ | ||
| export class NodeSqliteDialect extends SqliteDialect { | ||
| constructor(dbName) { | ||
| const { DatabaseSync } = globalThis.process.getBuiltinModule('node:sqlite'); | ||
| super({ | ||
| database: () => { | ||
| const db = new DatabaseSync(dbName); | ||
| return { | ||
| prepare(sql) { | ||
| const stmt = db.prepare(sql); | ||
| return { | ||
| reader: /^\s*(select|pragma|explain|with)/i.test(sql) || /\breturning\b/i.test(sql), | ||
| all: (params) => stmt.all(...params), | ||
| run: (params) => stmt.run(...params), | ||
| /* v8 ignore next */ | ||
| get: (params) => stmt.get(...params), | ||
| }; | ||
| }, | ||
| close() { db.close(); }, | ||
| }; | ||
| }, | ||
| }); | ||
| } | ||
| } |
| import type { Configuration } from '@mikro-orm/core'; | ||
| import { AbstractSqlDriver } from '../../AbstractSqlDriver.js'; | ||
| import { BaseSqliteConnection } from './BaseSqliteConnection.js'; | ||
| /** | ||
| * Generic SQLite driver that uses `driverOptions` for the Kysely dialect. | ||
| * Use this with any SQLite library by passing a Kysely dialect via `driverOptions`. | ||
| * | ||
| * For the default better-sqlite3 experience, use `@mikro-orm/sqlite` instead. | ||
| */ | ||
| export declare class SqliteDriver extends AbstractSqlDriver<BaseSqliteConnection> { | ||
| constructor(config: Configuration); | ||
| } |
| import { AbstractSqlDriver } from '../../AbstractSqlDriver.js'; | ||
| import { BaseSqliteConnection } from './BaseSqliteConnection.js'; | ||
| import { SqlitePlatform } from './SqlitePlatform.js'; | ||
| /** | ||
| * Generic SQLite driver that uses `driverOptions` for the Kysely dialect. | ||
| * Use this with any SQLite library by passing a Kysely dialect via `driverOptions`. | ||
| * | ||
| * For the default better-sqlite3 experience, use `@mikro-orm/sqlite` instead. | ||
| */ | ||
| export class SqliteDriver extends AbstractSqlDriver { | ||
| constructor(config) { | ||
| super(config, new SqlitePlatform(), BaseSqliteConnection, ['kysely']); | ||
| } | ||
| } |
| import { type EntityProperty, type IsolationLevel } from '@mikro-orm/core'; | ||
| import { AbstractSqlPlatform } from '../../AbstractSqlPlatform.js'; | ||
| import { SqliteNativeQueryBuilder } from './SqliteNativeQueryBuilder.js'; | ||
| import { SqliteSchemaHelper } from './SqliteSchemaHelper.js'; | ||
| import { SqliteExceptionConverter } from './SqliteExceptionConverter.js'; | ||
| export declare class SqlitePlatform extends AbstractSqlPlatform { | ||
| protected readonly schemaHelper: SqliteSchemaHelper; | ||
| protected readonly exceptionConverter: SqliteExceptionConverter; | ||
| /** @internal */ | ||
| createNativeQueryBuilder(): SqliteNativeQueryBuilder; | ||
| usesDefaultKeyword(): boolean; | ||
| usesReturningStatement(): boolean; | ||
| usesEnumCheckConstraints(): boolean; | ||
| getCurrentTimestampSQL(length: number): string; | ||
| getDateTimeTypeDeclarationSQL(column: { | ||
| length: number; | ||
| }): string; | ||
| getBeginTransactionSQL(options?: { | ||
| isolationLevel?: IsolationLevel; | ||
| readOnly?: boolean; | ||
| }): string[]; | ||
| getEnumTypeDeclarationSQL(column: { | ||
| items?: unknown[]; | ||
| fieldNames: string[]; | ||
| length?: number; | ||
| unsigned?: boolean; | ||
| autoincrement?: boolean; | ||
| }): string; | ||
| getTinyIntTypeDeclarationSQL(column: { | ||
| length?: number; | ||
| unsigned?: boolean; | ||
| autoincrement?: boolean; | ||
| }): string; | ||
| getSmallIntTypeDeclarationSQL(column: { | ||
| length?: number; | ||
| unsigned?: boolean; | ||
| autoincrement?: boolean; | ||
| }): string; | ||
| getIntegerTypeDeclarationSQL(column: { | ||
| length?: number; | ||
| unsigned?: boolean; | ||
| autoincrement?: boolean; | ||
| }): string; | ||
| getFloatDeclarationSQL(): string; | ||
| getBooleanTypeDeclarationSQL(): string; | ||
| getCharTypeDeclarationSQL(column: { | ||
| length?: number; | ||
| }): string; | ||
| getVarcharTypeDeclarationSQL(column: { | ||
| length?: number; | ||
| }): string; | ||
| normalizeColumnType(type: string, options: { | ||
| length?: number; | ||
| precision?: number; | ||
| scale?: number; | ||
| }): string; | ||
| convertsJsonAutomatically(): boolean; | ||
| /** | ||
| * This is used to narrow the value of Date properties as they will be stored as timestamps in sqlite. | ||
| * We use this method to convert Dates to timestamps when computing the changeset, so we have the right | ||
| * data type in the payload as well as in original entity data. Without that, we would end up with diffs | ||
| * including all Date properties, as we would be comparing Date object with timestamp. | ||
| */ | ||
| processDateProperty(value: unknown): string | number | Date; | ||
| getIndexName(tableName: string, columns: string[], type: 'index' | 'unique' | 'foreign' | 'primary' | 'sequence'): string; | ||
| supportsDeferredUniqueConstraints(): boolean; | ||
| /** | ||
| * SQLite supports schemas via ATTACH DATABASE. Returns true when there are | ||
| * attached databases configured. | ||
| */ | ||
| supportsSchemas(): boolean; | ||
| getDefaultSchemaName(): string | undefined; | ||
| getFullTextWhereClause(): string; | ||
| escape(value: any): string; | ||
| convertVersionValue(value: Date | number, prop: EntityProperty): number | { | ||
| $in: (string | number)[]; | ||
| }; | ||
| quoteValue(value: any): string; | ||
| } |
| import { AbstractSqlPlatform } from '../../AbstractSqlPlatform.js'; | ||
| import { SqliteNativeQueryBuilder } from './SqliteNativeQueryBuilder.js'; | ||
| import { SqliteSchemaHelper } from './SqliteSchemaHelper.js'; | ||
| import { SqliteExceptionConverter } from './SqliteExceptionConverter.js'; | ||
| export class SqlitePlatform extends AbstractSqlPlatform { | ||
| schemaHelper = new SqliteSchemaHelper(this); | ||
| exceptionConverter = new SqliteExceptionConverter(); | ||
| /** @internal */ | ||
| createNativeQueryBuilder() { | ||
| return new SqliteNativeQueryBuilder(this); | ||
| } | ||
| usesDefaultKeyword() { | ||
| return false; | ||
| } | ||
| usesReturningStatement() { | ||
| return true; | ||
| } | ||
| usesEnumCheckConstraints() { | ||
| return true; | ||
| } | ||
| getCurrentTimestampSQL(length) { | ||
| return `(strftime('%s', 'now') * 1000)`; | ||
| } | ||
| getDateTimeTypeDeclarationSQL(column) { | ||
| return 'datetime'; | ||
| } | ||
| getBeginTransactionSQL(options) { | ||
| return ['begin']; | ||
| } | ||
| getEnumTypeDeclarationSQL(column) { | ||
| if (column.items?.every(item => typeof item === 'string')) { | ||
| return 'text'; | ||
| } | ||
| /* v8 ignore next */ | ||
| return this.getTinyIntTypeDeclarationSQL(column); | ||
| } | ||
| getTinyIntTypeDeclarationSQL(column) { | ||
| return this.getIntegerTypeDeclarationSQL(column); | ||
| } | ||
| getSmallIntTypeDeclarationSQL(column) { | ||
| return this.getIntegerTypeDeclarationSQL(column); | ||
| } | ||
| getIntegerTypeDeclarationSQL(column) { | ||
| return 'integer'; | ||
| } | ||
| getFloatDeclarationSQL() { | ||
| return 'real'; | ||
| } | ||
| getBooleanTypeDeclarationSQL() { | ||
| return 'integer'; | ||
| } | ||
| getCharTypeDeclarationSQL(column) { | ||
| return 'text'; | ||
| } | ||
| getVarcharTypeDeclarationSQL(column) { | ||
| return 'text'; | ||
| } | ||
| normalizeColumnType(type, options) { | ||
| const simpleType = this.extractSimpleType(type); | ||
| if (['varchar', 'text'].includes(simpleType)) { | ||
| return this.getVarcharTypeDeclarationSQL(options); | ||
| } | ||
| return simpleType; | ||
| } | ||
| convertsJsonAutomatically() { | ||
| return false; | ||
| } | ||
| /** | ||
| * This is used to narrow the value of Date properties as they will be stored as timestamps in sqlite. | ||
| * We use this method to convert Dates to timestamps when computing the changeset, so we have the right | ||
| * data type in the payload as well as in original entity data. Without that, we would end up with diffs | ||
| * including all Date properties, as we would be comparing Date object with timestamp. | ||
| */ | ||
| processDateProperty(value) { | ||
| if (value instanceof Date) { | ||
| return +value; | ||
| } | ||
| return value; | ||
| } | ||
| getIndexName(tableName, columns, type) { | ||
| if (type === 'primary') { | ||
| return this.getDefaultPrimaryName(tableName, columns); | ||
| } | ||
| return super.getIndexName(tableName, columns, type); | ||
| } | ||
| supportsDeferredUniqueConstraints() { | ||
| return false; | ||
| } | ||
| /** | ||
| * SQLite supports schemas via ATTACH DATABASE. Returns true when there are | ||
| * attached databases configured. | ||
| */ | ||
| supportsSchemas() { | ||
| const attachDatabases = this.config.get('attachDatabases'); | ||
| return !!attachDatabases?.length; | ||
| } | ||
| getDefaultSchemaName() { | ||
| // Return 'main' only when schema support is active (i.e., databases are attached) | ||
| return this.supportsSchemas() ? 'main' : undefined; | ||
| } | ||
| getFullTextWhereClause() { | ||
| return `:column: match :query`; | ||
| } | ||
| escape(value) { | ||
| if (value == null) { | ||
| return 'null'; | ||
| } | ||
| if (typeof value === 'boolean') { | ||
| return value ? 'true' : 'false'; | ||
| } | ||
| if (typeof value === 'number' || typeof value === 'bigint') { | ||
| return '' + value; | ||
| } | ||
| if (value instanceof Date) { | ||
| return '' + +value; | ||
| } | ||
| if (Array.isArray(value)) { | ||
| return value.map(v => this.escape(v)).join(', '); | ||
| } | ||
| if (Buffer.isBuffer(value)) { | ||
| return `X'${value.toString('hex')}'`; | ||
| } | ||
| return `'${String(value).replace(/'/g, "''")}'`; | ||
| } | ||
| convertVersionValue(value, prop) { | ||
| if (prop.runtimeType === 'Date') { | ||
| const ts = +value; | ||
| const str = new Date(ts).toISOString().replace('T', ' ').replace(/\.\d{3}Z$/, ''); | ||
| return { $in: [ts, str] }; | ||
| } | ||
| return value; | ||
| } | ||
| quoteValue(value) { | ||
| if (value instanceof Date) { | ||
| return '' + +value; | ||
| } | ||
| return super.quoteValue(value); | ||
| } | ||
| } |
@@ -0,3 +1,6 @@ | ||
| import { type Dialect } from 'kysely'; | ||
| import type { Dictionary } from '@mikro-orm/core'; | ||
| import { AbstractSqlConnection } from '../../AbstractSqlConnection.js'; | ||
| export declare abstract class BaseSqliteConnection extends AbstractSqlConnection { | ||
| export declare class BaseSqliteConnection extends AbstractSqlConnection { | ||
| createKyselyDialect(options: Dictionary): Dialect; | ||
| connect(options?: { | ||
@@ -4,0 +7,0 @@ skipOnConnect?: boolean; |
| import { CompiledQuery } from 'kysely'; | ||
| import { AbstractSqlConnection } from '../../AbstractSqlConnection.js'; | ||
| export class BaseSqliteConnection extends AbstractSqlConnection { | ||
| createKyselyDialect(options) { | ||
| throw new Error('No SQLite dialect configured. Pass a Kysely dialect via the `driverOptions` config option, ' | ||
| + 'e.g. `new NodeSqliteDialect(...)` for node:sqlite or a custom dialect for other libraries.'); | ||
| } | ||
| async connect(options) { | ||
@@ -5,0 +9,0 @@ await super.connect(options); |
| export * from './BaseSqliteConnection.js'; | ||
| export * from './BaseSqlitePlatform.js'; | ||
| export * from './NodeSqliteDialect.js'; | ||
| export * from './SqliteDriver.js'; | ||
| export * from './SqlitePlatform.js'; | ||
| export * from './SqliteSchemaHelper.js'; | ||
| export * from './SqliteNativeQueryBuilder.js'; |
| export * from './BaseSqliteConnection.js'; | ||
| export * from './BaseSqlitePlatform.js'; | ||
| export * from './NodeSqliteDialect.js'; | ||
| export * from './SqliteDriver.js'; | ||
| export * from './SqlitePlatform.js'; | ||
| export * from './SqliteSchemaHelper.js'; | ||
| export * from './SqliteNativeQueryBuilder.js'; |
@@ -42,2 +42,7 @@ import { type Connection } from '@mikro-orm/core'; | ||
| private getColumns; | ||
| /** | ||
| * SQLite strips outer parentheses from expression defaults (`DEFAULT (expr)` → `expr` in pragma). | ||
| * We need to add them back so they match what we generate in DDL. | ||
| */ | ||
| private wrapExpressionDefault; | ||
| private getEnumDefinitions; | ||
@@ -44,0 +49,0 @@ getPrimaryKeys(connection: AbstractSqlConnection, indexes: IndexDef[], tableName: string, schemaName?: string): Promise<string[]>; |
@@ -289,3 +289,3 @@ import { Utils } from '@mikro-orm/core'; | ||
| type: col.type, | ||
| default: col.dflt_value, | ||
| default: this.wrapExpressionDefault(col.dflt_value), | ||
| nullable: !col.notnull, | ||
@@ -300,2 +300,21 @@ primary: !!col.pk, | ||
| } | ||
| /** | ||
| * SQLite strips outer parentheses from expression defaults (`DEFAULT (expr)` → `expr` in pragma). | ||
| * We need to add them back so they match what we generate in DDL. | ||
| */ | ||
| wrapExpressionDefault(value) { | ||
| if (value == null) { | ||
| return null; | ||
| } | ||
| // simple values that are returned as-is from pragma (no wrapping needed) | ||
| if (/^-?\d/.test(value) || /^[xX]'/.test(value) || value[0] === "'" || value[0] === '"' || value[0] === '(') { | ||
| return value; | ||
| } | ||
| const lower = value.toLowerCase(); | ||
| if (['null', 'true', 'false', 'current_timestamp', 'current_date', 'current_time'].includes(lower)) { | ||
| return value; | ||
| } | ||
| // everything else is an expression that had its outer parens stripped | ||
| return `(${value})`; | ||
| } | ||
| async getEnumDefinitions(connection, tableName, schemaName) { | ||
@@ -302,0 +321,0 @@ const prefix = this.getSchemaPrefix(schemaName); |
+2
-2
| { | ||
| "name": "@mikro-orm/sql", | ||
| "version": "7.0.0-dev.266", | ||
| "version": "7.0.0-dev.267", | ||
| "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.", | ||
@@ -59,4 +59,4 @@ "type": "module", | ||
| "peerDependencies": { | ||
| "@mikro-orm/core": "7.0.0-dev.266" | ||
| "@mikro-orm/core": "7.0.0-dev.267" | ||
| } | ||
| } |
| import { type EntityProperty, type IsolationLevel } from '@mikro-orm/core'; | ||
| import { AbstractSqlPlatform } from '../../AbstractSqlPlatform.js'; | ||
| import { SqliteNativeQueryBuilder } from './SqliteNativeQueryBuilder.js'; | ||
| import { SqliteSchemaHelper } from './SqliteSchemaHelper.js'; | ||
| import { SqliteExceptionConverter } from './SqliteExceptionConverter.js'; | ||
| export declare abstract class BaseSqlitePlatform extends AbstractSqlPlatform { | ||
| protected readonly schemaHelper: SqliteSchemaHelper; | ||
| protected readonly exceptionConverter: SqliteExceptionConverter; | ||
| /** @internal */ | ||
| createNativeQueryBuilder(): SqliteNativeQueryBuilder; | ||
| usesDefaultKeyword(): boolean; | ||
| usesReturningStatement(): boolean; | ||
| usesEnumCheckConstraints(): boolean; | ||
| getCurrentTimestampSQL(length: number): string; | ||
| getDateTimeTypeDeclarationSQL(column: { | ||
| length: number; | ||
| }): string; | ||
| getBeginTransactionSQL(options?: { | ||
| isolationLevel?: IsolationLevel; | ||
| readOnly?: boolean; | ||
| }): string[]; | ||
| getEnumTypeDeclarationSQL(column: { | ||
| items?: unknown[]; | ||
| fieldNames: string[]; | ||
| length?: number; | ||
| unsigned?: boolean; | ||
| autoincrement?: boolean; | ||
| }): string; | ||
| getTinyIntTypeDeclarationSQL(column: { | ||
| length?: number; | ||
| unsigned?: boolean; | ||
| autoincrement?: boolean; | ||
| }): string; | ||
| getSmallIntTypeDeclarationSQL(column: { | ||
| length?: number; | ||
| unsigned?: boolean; | ||
| autoincrement?: boolean; | ||
| }): string; | ||
| getIntegerTypeDeclarationSQL(column: { | ||
| length?: number; | ||
| unsigned?: boolean; | ||
| autoincrement?: boolean; | ||
| }): string; | ||
| getFloatDeclarationSQL(): string; | ||
| getBooleanTypeDeclarationSQL(): string; | ||
| getCharTypeDeclarationSQL(column: { | ||
| length?: number; | ||
| }): string; | ||
| getVarcharTypeDeclarationSQL(column: { | ||
| length?: number; | ||
| }): string; | ||
| normalizeColumnType(type: string, options: { | ||
| length?: number; | ||
| precision?: number; | ||
| scale?: number; | ||
| }): string; | ||
| convertsJsonAutomatically(): boolean; | ||
| /** | ||
| * This is used to narrow the value of Date properties as they will be stored as timestamps in sqlite. | ||
| * We use this method to convert Dates to timestamps when computing the changeset, so we have the right | ||
| * data type in the payload as well as in original entity data. Without that, we would end up with diffs | ||
| * including all Date properties, as we would be comparing Date object with timestamp. | ||
| */ | ||
| processDateProperty(value: unknown): string | number | Date; | ||
| getIndexName(tableName: string, columns: string[], type: 'index' | 'unique' | 'foreign' | 'primary' | 'sequence'): string; | ||
| supportsDeferredUniqueConstraints(): boolean; | ||
| /** | ||
| * SQLite supports schemas via ATTACH DATABASE. Returns true when there are | ||
| * attached databases configured. | ||
| */ | ||
| supportsSchemas(): boolean; | ||
| getDefaultSchemaName(): string | undefined; | ||
| getFullTextWhereClause(): string; | ||
| quoteVersionValue(value: Date | number, prop: EntityProperty): Date | string | number; | ||
| quoteValue(value: any): string; | ||
| } |
| import { AbstractSqlPlatform } from '../../AbstractSqlPlatform.js'; | ||
| import { SqliteNativeQueryBuilder } from './SqliteNativeQueryBuilder.js'; | ||
| import { SqliteSchemaHelper } from './SqliteSchemaHelper.js'; | ||
| import { SqliteExceptionConverter } from './SqliteExceptionConverter.js'; | ||
| export class BaseSqlitePlatform extends AbstractSqlPlatform { | ||
| schemaHelper = new SqliteSchemaHelper(this); | ||
| exceptionConverter = new SqliteExceptionConverter(); | ||
| /** @internal */ | ||
| createNativeQueryBuilder() { | ||
| return new SqliteNativeQueryBuilder(this); | ||
| } | ||
| usesDefaultKeyword() { | ||
| return false; | ||
| } | ||
| usesReturningStatement() { | ||
| return true; | ||
| } | ||
| usesEnumCheckConstraints() { | ||
| return true; | ||
| } | ||
| getCurrentTimestampSQL(length) { | ||
| return super.getCurrentTimestampSQL(0); | ||
| } | ||
| getDateTimeTypeDeclarationSQL(column) { | ||
| return 'datetime'; | ||
| } | ||
| getBeginTransactionSQL(options) { | ||
| return ['begin']; | ||
| } | ||
| getEnumTypeDeclarationSQL(column) { | ||
| if (column.items?.every(item => typeof item === 'string')) { | ||
| return 'text'; | ||
| } | ||
| /* v8 ignore next */ | ||
| return this.getTinyIntTypeDeclarationSQL(column); | ||
| } | ||
| getTinyIntTypeDeclarationSQL(column) { | ||
| return this.getIntegerTypeDeclarationSQL(column); | ||
| } | ||
| getSmallIntTypeDeclarationSQL(column) { | ||
| return this.getIntegerTypeDeclarationSQL(column); | ||
| } | ||
| getIntegerTypeDeclarationSQL(column) { | ||
| return 'integer'; | ||
| } | ||
| getFloatDeclarationSQL() { | ||
| return 'real'; | ||
| } | ||
| getBooleanTypeDeclarationSQL() { | ||
| return 'integer'; | ||
| } | ||
| getCharTypeDeclarationSQL(column) { | ||
| return 'text'; | ||
| } | ||
| getVarcharTypeDeclarationSQL(column) { | ||
| return 'text'; | ||
| } | ||
| normalizeColumnType(type, options) { | ||
| const simpleType = this.extractSimpleType(type); | ||
| if (['varchar', 'text'].includes(simpleType)) { | ||
| return this.getVarcharTypeDeclarationSQL(options); | ||
| } | ||
| return simpleType; | ||
| } | ||
| convertsJsonAutomatically() { | ||
| return false; | ||
| } | ||
| /** | ||
| * This is used to narrow the value of Date properties as they will be stored as timestamps in sqlite. | ||
| * We use this method to convert Dates to timestamps when computing the changeset, so we have the right | ||
| * data type in the payload as well as in original entity data. Without that, we would end up with diffs | ||
| * including all Date properties, as we would be comparing Date object with timestamp. | ||
| */ | ||
| processDateProperty(value) { | ||
| if (value instanceof Date) { | ||
| return +value; | ||
| } | ||
| return value; | ||
| } | ||
| getIndexName(tableName, columns, type) { | ||
| if (type === 'primary') { | ||
| return this.getDefaultPrimaryName(tableName, columns); | ||
| } | ||
| return super.getIndexName(tableName, columns, type); | ||
| } | ||
| supportsDeferredUniqueConstraints() { | ||
| return false; | ||
| } | ||
| /** | ||
| * SQLite supports schemas via ATTACH DATABASE. Returns true when there are | ||
| * attached databases configured. | ||
| */ | ||
| supportsSchemas() { | ||
| const attachDatabases = this.config.get('attachDatabases'); | ||
| return !!attachDatabases?.length; | ||
| } | ||
| getDefaultSchemaName() { | ||
| // Return 'main' only when schema support is active (i.e., databases are attached) | ||
| return this.supportsSchemas() ? 'main' : undefined; | ||
| } | ||
| getFullTextWhereClause() { | ||
| return `:column: match :query`; | ||
| } | ||
| quoteVersionValue(value, prop) { | ||
| if (prop.runtimeType === 'Date') { | ||
| return this.escape(value).replace(/^'|\.\d{3}'$/g, ''); | ||
| } | ||
| return value; | ||
| } | ||
| quoteValue(value) { | ||
| if (value instanceof Date) { | ||
| return '' + +value; | ||
| } | ||
| return super.quoteValue(value); | ||
| } | ||
| } |
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
915248
0.67%102
4.08%16275
0.92%91
2.25%