postgresql – Knex迁移不起作用,怎么回事?
发布时间:2020-12-13 16:00:07 所属栏目:百科 来源:网络整理
导读:我似乎无法使用knex迁移数据库.在up命令中,它失败了. knex.migrate.latest({}).finally(function () { knex.destroy()}) 我收到一个错误. Possibly unhandled TypeError: undefined is not a function at SchemaBuilder_PG.Target.then (cwd/node_modules/kn
我似乎无法使用knex迁移数据库.在up命令中,它失败了.
knex.migrate.latest({}).finally(function () { knex.destroy() }) 我收到一个错误. Possibly unhandled TypeError: undefined is not a function at SchemaBuilder_PG.Target.then (cwd/node_modules/knex/lib/interface.js:25:10) at SchemaBuilder_PG.Target.(anonymous function) [as bind] (cwd/node_modules/knex/lib/interface.js:71:21) at Migrator_PG.<anonymous> (cwd/node_modules/knex/lib/migrate/index.js:93:6) at Migrator_PG.<anonymous> (cwd/node_modules/knex/lib/migrate/index.js:138:15) at Migrator_PG.Migrator._migrationData (cwd/node_modules/knex/lib/migrate/index.js:154:10) at Migrator_PG.<anonymous> (cwd/node_modules/knex/lib/migrate/index.js:22:15) From previous event: at Function.Promise$All [as all] (cwd/node_modules/knex/node_modules/bluebird/js/main/promise.js:198:12) at Migrator_PG.Migrator._migrationData (cwd/node_modules/knex/lib/migrate/index.js:152:18) at Migrator_PG.<anonymous> (cwd/node_modules/knex/lib/migrate/index.js:22:15) 我发誓昨天工作了.我尝试删除并重新创建数据库.没运气.怎么了?我怎样才能解决这个问题? 在knex来源中似乎没有任何明显的挖掘. 解决方法
没关系,是愚蠢的.尝试在未设置的配置中使用环境变量.
var knex = require('knex') var config = { client: 'pg',connection: process.env.DATABASE_URL,} module.exports = knex(config) 现在工作. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |