Skip to content

unable to create migration when using db-migrate as a module #493

@TsvetomirGeorgiev

Description

@TsvetomirGeorgiev

Code:
const dbmigrate = DBMigrate.getInstance(true, config.migrate);
dbmigrate.setConfigParam('_', []);
dbmigrate.create(migrationName).catch(console.error);

Exception thrown:
[ERROR] TypeError: Cannot read property 'getUTCFullYear' of undefined
at formatDate (..\node_modules\db-migrate\lib\skeleton.js:23:9)
at Class.formatName (..\node_modules\db-migrate\lib\skeleton.js:18:10)
at Class.init (..\node_modules\db-migrate\lib\migration.js:21:24)
at Class.prototype.(anonymous function) [as init] (..\node_modules\db-migrate\lib\class.js:36:24)
at new Class (..\node_modules\db-migrate\lib\class.js:49:17)
at ..\node_modules\db-migrate\api.js:648:21
at ..\node_modules\db-migrate\api.js:560:7
at FSReqWrap.oncomplete (fs.js:153:5)

Exception is due to
41628f7
Merge pull request #485 from gmanriqueUy/master
fix(create): use same timestamp in every created file

internals.runTimestamp = new Date();
is only set when db-migrate is run throu the CLI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions