Make sure you have ts-node installed: npm install ts-node
This creates a .ts file in migrations directory
npm run knex:migrate:make -- some-migration-name
npm run knex:migrate:latest
npm run knex:migrate:rollback
knexfile.ts
requiresrequire('ts-node/register');
to work.- ES6/ES2015 module syntax does not work in knexfile or in any files that it
require()
s
FYI doesn't work in knex v0.21.1. for command,
knex --knexfile ./knexfile.ts -x ts migrate:make
I get, "unknown option '-x'". No matter what knex does not seem to be passing through ts-node because I getThat import statement is in my knex.ts