gpt4 book ai didi

adonis.js - 阿多尼斯问题 : error: `migration:run` is not a registered command

转载 作者:行者123 更新时间:2023-12-02 03:10:11 27 4
gpt4 key购买 nike

我已经安装了@adonisjs/lucid。创建迁移以使用命令

adonis make:migration task

**任务代码**

'use strict'

const Schema = use('Schema')

class TaskSchema extends Schema {
up() {
this.create('tasks', table => {
table.increments()
table.timestamps()
table.string('name')
table.text('description')
table.integer('project_id').unsigned()
table
.foreign('project_id')
.references('projects.id')
.onDelete('cascade')
})
}

down() {
this.drop('tasks')
}
}

module.exports = TaskSchema

我已运行迁移以显示此错误

error: `migration:run` is not a registered command

**

i have not understand this bug. I know that if not install the dependencies @adonisjs/lucid than show this error but After I installed dependencies why the error occurred

**

最佳答案

这里你需要的是 adonis/cli。

npm i -g @adonisjs/cli

但我认为您并不真正需要这种额外的依赖项。使用ace就够了

node ace make:migration task

关于adonis.js - 阿多尼斯问题 : error: `migration:run` is not a registered command,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60250708/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com