@nyffels/mynodeorm
Advanced tools
Comparing version 1.0.0-alpha78 to 1.0.0-alpha79
@@ -27,3 +27,3 @@ #! /usr/bin/env node | ||
const fullPath = fileLocation.startsWith(".") ? path.join(workdir, fileLocation) : fileLocation; | ||
const schemaScriptPath = path.join(fullPath, "mynodeorm-migration-config.ts"); | ||
const schemaScriptPath = path.join(fullPath, "mynodeorm-migration.ts"); | ||
if (fs.existsSync(schemaScriptPath)) { | ||
@@ -41,3 +41,3 @@ console.log(`• Schema config file already exists. Delete existing one...`); | ||
const args = process.argv.slice(2); | ||
if (!args.some(e => /^--name=*./.test(e))) { | ||
@@ -54,6 +54,3 @@ console.error("❌ Name is required for a migration. Use '--name={{name}}' to declare a name of this migration."); | ||
const configurationLocationPath = args.find((a) => a.includes('--config-location=')) | ||
?.replace('--config-location=', '') ?? "./"; | ||
createMigration(name, dbClasses, migrationLocationPath, configurationLocationPath); | ||
createMigration(name, dbClasses, migrationLocationPath); | ||
`; | ||
@@ -63,5 +60,2 @@ fs.writeFileSync(schemaScriptPath, migrationsScript, { encoding: "utf8" }); | ||
} | ||
else if (args.includes("--migrate")) { | ||
// TODO | ||
} | ||
else if (args.includes("--generate-integration-script")) { | ||
@@ -188,11 +182,2 @@ const runIntegration = () => __awaiter(void 0, void 0, void 0, function* () { | ||
} | ||
function getDateFormat() { | ||
const date = new Date(); | ||
const year = date.getFullYear() | ||
.toString(); | ||
const month = (date.getMonth() + 1).toString(); | ||
const day = date.getDate() | ||
.toString(); | ||
return year + month + day; | ||
} | ||
//# sourceMappingURL=app.js.map |
@@ -1,1 +0,1 @@ | ||
export declare function createMigration(name: string, classes: any[], migrationLocationPath: string, configurationLocationPath: string): void; | ||
export declare function createMigration(name: string, classes: any[], migrationLocationPath: string): void; |
import path from "node:path"; | ||
import fs from "node:fs"; | ||
import { getObjectsInIdTable } from "../decorators/class.decorator.js"; | ||
export function createMigration(name, classes, migrationLocationPath, configurationLocationPath) { | ||
export function createMigration(name, classes, migrationLocationPath) { | ||
if (!name) { | ||
@@ -10,7 +10,2 @@ console.error("❌ Name is required for a migration. Use '--name={{name}}' to declare a name of this migration."); | ||
const migrationLocation = path.join(process.cwd(), migrationLocationPath, "migrations"); | ||
const configurationLocation = path.join(process.cwd(), configurationLocationPath, "mynodeorm-migration-config.ts"); | ||
if (!fs.existsSync(configurationLocation)) { | ||
console.error(`❌ Configuration not found on location ${configurationLocation}`); | ||
process.exit(1); | ||
} | ||
if (!fs.existsSync(migrationLocation)) { | ||
@@ -278,2 +273,11 @@ console.log("• Migration location does not exists... Creating folder."); | ||
} | ||
function getDateFormat() { | ||
const date = new Date(); | ||
const year = date.getFullYear() | ||
.toString(); | ||
const month = (date.getMonth() + 1).toString(); | ||
const day = date.getDate() | ||
.toString(); | ||
return year + month + day; | ||
} | ||
//# sourceMappingURL=migration.logic.js.map |
{ | ||
"name": "@nyffels/mynodeorm", | ||
"version": "1.0.0-alpha78", | ||
"version": "1.0.0-alpha79", | ||
"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
147571
2255