douglas-treadwell / sequelize-cli-typescript

The Sequelize CLI
MIT License
48 stars 21 forks source link

Unable to create migrations #1

Closed modulitos closed 5 years ago

modulitos commented 6 years ago

What you are doing?

I want to create a migration, but I am encountering an error.

sequelize migration:generate --env postgres --name my-migration

What do you expect to happen?

Have a migration created.

What is actually happening?

I am getting this error:

(utils) [my-pc]/home/.../my-project$ sequelize migration:generate --env postgres --name my-migration

Sequelize CLI [Node: 8.9.4, CLI: 3.2.0-c, ORM: 4.31.2]

WARNING: This version of Sequelize CLI is not fully compatible with Sequelize v4. https://github.com/sequelize/cli#sequelize-support

migrations folder at "/home/me/projects/my-project/migrations-ts" already exists. /home/me/projects/my-project/node_modules/sequelize-cli-typescript/node_modules/yargs/yargs.js:1079 else throw err ^

Error: ENOENT: no such file or directory, open '/home/me/projects/my-project/node_modules/sequelize-cli-typescript/lib/assets/migrations/skeleton.js' at Object.fs.openSync (fs.js:646:18) at Object.fs.readFileSync (fs.js:551:33) at Object.read (/home/me/projects/my-project/node_modules/sequelize-cli-typescript/lib/helpers/asset-helper.js:19:30) at Object.render (/home/me/projects/my-project/node_modules/sequelize-cli-typescript/lib/helpers/template-helper.js:28:42) at Object.exports.handler (/home/me/projects/my-project/node_modules/sequelize-cli-typescript/lib/commands/migration_generate.js:30:115) at Object.self.runCommand (/home/me/projects/my-project/node_modules/sequelize-cli-typescript/node_modules/yargs/lib/command.js:233:22) at Object.Yargs.self._parseArgs (/home/me/projects/my-project/node_modules/sequelize-cli-typescript/node_modules/yargs/yargs.js:990:30) at Object.get [as argv] (/home/me/projects/my-project/node_modules/sequelize-cli-typescript/node_modules/yargs/yargs.js:927:19) at Object. (/home/me/projects/my-project/node_modules/sequelize-cli-typescript/lib/sequelize:84:16) at Module._compile (module.js:643:30) at Object.Module._extensions..js (module.js:654:10) at Module.load (module.js:556:32) at tryModuleLoad (module.js:499:12) at Function.Module._load (module.js:491:3) at Function.Module.runMain (module.js:684:10) at startup (bootstrap_node.js:187:16) at bootstrap_node.js:608:3

I see that this repo contains a file sequelize-cli-typescript/lib/assets/migrations/skeleton.ts. Perhaps that file should be renamed with a .js extension?

Dialect: postgres Database version: PostgreSQL 10.1 on x86_64-pc-linux-musl, compiled by gcc (Alpine 6.3.0) 6.3.0, 64-bit Sequelize CLI version: 3.2.0-c Sequelize version: 4.17.0

messerbill commented 6 years ago

https://github.com/douglas-treadwell/sequelize-cli-typescript/pull/2 fixes the issue. Please merge this.

omieliekh commented 5 years ago

FYI, there is more fresh fork that is still being maintained: https://github.com/wildcookie007/sequelize-cli-typescript

Fix for this issue is there, plus numerous of other fixes 🎉

Can be included in package.json like this:

"dependencies": {
  "sequelize-cli-typescript": "git+ssh://git@github.com:wildcookie007/sequelize-cli-typescript.git#master",
}

After, run npm i to install it.