🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@mikro-orm/sql

Package Overview
Dependencies
Maintainers
1
Versions
672
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mikro-orm/sql - npm Package Compare versions

Comparing version
7.1.2-dev.10
to
7.1.2-dev.11
+1
-0
dialects/sqlite/SqlitePlatform.d.ts

@@ -14,2 +14,3 @@ import { type EntityProperty, type IsolationLevel } from '@mikro-orm/core';

usesEnumCheckConstraints(): boolean;
supportsComments(): boolean;
getCurrentTimestampSQL(length: number): string;

@@ -16,0 +17,0 @@ getDateTimeTypeDeclarationSQL(column: {

@@ -21,2 +21,6 @@ import { AbstractSqlPlatform } from '../../AbstractSqlPlatform.js';

}
// sqlite has no table/column comments, so they cannot round-trip through introspection
supportsComments() {
return false;
}
getCurrentTimestampSQL(length) {

@@ -23,0 +27,0 @@ return `(strftime('%s', 'now') * 1000)`;

+2
-2
{
"name": "@mikro-orm/sql",
"version": "7.1.2-dev.10",
"version": "7.1.2-dev.11",
"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.",

@@ -56,3 +56,3 @@ "keywords": [

"peerDependencies": {
"@mikro-orm/core": "7.1.2-dev.10"
"@mikro-orm/core": "7.1.2-dev.11"
},

@@ -59,0 +59,0 @@ "engines": {

@@ -978,2 +978,3 @@ import { DecimalType, EntitySchema, isRaw, ReferenceKind, t, Type, UnknownType, Utils, } from '@mikro-orm/core';

const supportsUnsigned = this.#platform.supportsUnsigned();
const supportsComments = this.#platform.supportsComments();
const columnsMapped = sortedColumnKeys.reduce((o, col) => {

@@ -1007,3 +1008,3 @@ const c = columns[col];

default: defaultValue,
comment: c.comment || null,
comment: supportsComments ? c.comment || null : null,
collation: c.collation ?? null,

@@ -1097,6 +1098,7 @@ enumItems: c.enumItems ?? [],

// emit `comment` even when unset so introspection (which always reads it) matches metadata;
// collapse mysql's `""` for unset comments to `null` so both sources agree
comment: this.comment || null,
// collapse mysql's `""` for unset comments to `null` so both sources agree. drop entirely on
// platforms that can't read comments back (sqlite), where keeping it would flip the snapshot
comment: supportsComments ? this.comment || null : null,
};
}
}

@@ -342,3 +342,3 @@ import { ArrayType, BooleanType, DateTimeType, DecimalType, inspect, JsonType, parseJsonSafe, Utils, } from '@mikro-orm/core';

};
if (this.diffComment(fromTable.comment, toTable.comment)) {
if (this.#platform.supportsComments() && this.diffComment(fromTable.comment, toTable.comment)) {
tableDifferences.changedComment = toTable.comment;

@@ -717,3 +717,3 @@ this.log(`table comment changed for ${tableDifferences.name}`, {

}
if (this.diffComment(fromColumn.comment, toColumn.comment)) {
if (this.#platform.supportsComments() && this.diffComment(fromColumn.comment, toColumn.comment)) {
log(`'comment' changed for column ${fromTable.name}.${fromColumn.name}`, { fromColumn, toColumn });

@@ -720,0 +720,0 @@ changedProperties.add('comment');