@nyffels/mynodeorm
Advanced tools
Comparing version 1.0.0-alpha90 to 1.0.0-alpha92
@@ -106,4 +106,8 @@ import path from "node:path"; | ||
// @ts-ignore | ||
uplogic += `.defaultSql('${sColumn.defaultSql}')`; | ||
uplogic += `.defaultSql('${sColumn.defaultSql.replaceAll('\'', '\\\'')}')`; | ||
} | ||
if ((sColumn === null || sColumn === void 0 ? void 0 : sColumn.foreignKey) !== null) { | ||
// @ts-ignore | ||
uplogic += `.foreignKey('${sColumn.foreignKey.table}', '${sColumn.foreignKey.column}', ${sColumn.foreignKey.onDelete}, ${sColumn.foreignKey.onUpdate})`; | ||
} | ||
uplogic += `;`; | ||
@@ -230,3 +234,3 @@ }); | ||
// @ts-ignore | ||
downlogic += `.defaultSql('${sColumn.defaultSql}')`; | ||
downlogic += `.defaultSql('${sColumn.defaultSql.replaceAll('\'', '\\\'')}')`; | ||
} | ||
@@ -233,0 +237,0 @@ if ((sColumn === null || sColumn === void 0 ? void 0 : sColumn.foreignKey) !== null) { |
@@ -38,2 +38,3 @@ import { ForeignKeyOption } from "../decorators/index.js"; | ||
private _defaultSql; | ||
private _foreignKey; | ||
constructor(name: string, type: string, options: MigrationColumnOptions); | ||
@@ -46,3 +47,3 @@ primary(): this; | ||
defaultSql(sql: string): this; | ||
foreignKey(table: string, column: string, onDelete: ForeignKeyOption, onUpdate: ForeignKeyOption): void; | ||
foreignKey(table: string, column: string, onDelete: ForeignKeyOption, onUpdate: ForeignKeyOption): this; | ||
getValues(): { | ||
@@ -49,0 +50,0 @@ name: string; |
@@ -124,2 +124,3 @@ export class MigrationFileBuilder { | ||
this._defaultSql = null; | ||
this._foreignKey = null; | ||
this._name = name; | ||
@@ -155,3 +156,4 @@ this._type = type; | ||
foreignKey(table, column, onDelete, onUpdate) { | ||
// TODO | ||
this._foreignKey = { table, column, onDelete, onUpdate }; | ||
return this; | ||
} | ||
@@ -158,0 +160,0 @@ getValues() { |
{ | ||
"name": "@nyffels/mynodeorm", | ||
"version": "1.0.0-alpha90", | ||
"version": "1.0.0-alpha92", | ||
"description": "A full-fledged ORM framework for NodeJS and MySQL with develop friendly code aimed to handle database migrations, MySQL Query builder / helper and property mapping.", | ||
@@ -5,0 +5,0 @@ "private": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
170725
2467