@nyffels/mynodeorm
Advanced tools
Comparing version 1.0.0-alpha83 to 1.0.0-alpha84
@@ -214,3 +214,3 @@ #! /usr/bin/env node | ||
if (columnsToDelete.length > 0) { | ||
dropColumnScript = `DROP COLUMN ${columnsToDelete.join(', ')}`; | ||
dropColumnScript = `${columnsToDelete.map(c => `DROP COLUMN ${c}`).join(', ')}`; | ||
} | ||
@@ -220,3 +220,2 @@ if (columnsToCheck.length > 0) { | ||
let hasDifferences = false; | ||
const differences = []; | ||
const dbColumn = dbTableSchema[column]; | ||
@@ -229,3 +228,2 @@ const migrationColumn = migrationTableSchema[column]; | ||
hasDifferences = true; | ||
differences.push("type"); | ||
if (table === "tbl_account_number" && hasDifferences) { | ||
@@ -248,15 +246,11 @@ console.log(column); | ||
hasDifferences = true; | ||
differences.push("autoIncrement"); | ||
} | ||
if (dbColumn.nullable != migrationColumn.nullable) { | ||
hasDifferences = true; | ||
differences.push("nullable"); | ||
} | ||
if (dbColumn.defaultSql != migrationColumn.defaultSql) { | ||
hasDifferences = true; | ||
differences.push("defaultSql"); | ||
} | ||
if (dbColumn.unsigned != migrationColumn.unsigned) { | ||
hasDifferences = true; | ||
differences.push("unsigned"); | ||
} | ||
@@ -299,3 +293,5 @@ if (hasDifferences) { | ||
} | ||
scriptLines.push(`ALTER TABLE ${table} ${lines.join(', ')};`); | ||
if (lines.length > 0) { | ||
scriptLines.push(`ALTER TABLE ${table} ${lines.join(', ')};`); | ||
} | ||
} | ||
@@ -302,0 +298,0 @@ if (redoPrimaryKeys.length > 0) { |
@@ -39,5 +39,7 @@ import path from "node:path"; | ||
} | ||
schema[table] = { | ||
columns: {} | ||
}; | ||
if (!schema[table]) { | ||
schema[table] = { | ||
columns: {} | ||
}; | ||
} | ||
const properties = getAllProperties(dbClass); | ||
@@ -44,0 +46,0 @@ for (let property of properties) { |
{ | ||
"name": "@nyffels/mynodeorm", | ||
"version": "1.0.0-alpha83", | ||
"version": "1.0.0-alpha84", | ||
"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
162815
2376