所以我创建了一个表并稍后修改它以添加外键。我按照这个/sf/answers/3319971231/但它给了我一个错误,说
“错误:必须通过 options.fields 指定字段”
我正在使用sequelize ^6.6.5,我的节点版本是14.17.6,下面提供了我的代码
module.exports = {
up: async (queryInterface, Sequelize) =>
Promise.all([
await queryInterface.addColumn('bonus_transactions', 'wallet_id', {
type: Sequelize.INTEGER.UNSIGNED,
allowNull: false,
after: 'order_id'
}),
await queryInterface.addConstraint('bonus_transactions', ['wallet_id'], {
type: 'FOREIGN KEY',
name: 'FK_bonus_transactions_wallet_id',
references: {
table: 'wallets',
field: 'id'
},
onDelete: 'CASCADE'
})
]),
down: queryInterface => queryInterface.removeColumn('bonus_transactions', 'wallet_id')
Run Code Online (Sandbox Code Playgroud)
这可能是因为续集版本的原因吗?我搜索了 v6 文档,似乎没有任何与此类似的实现。
我正在按照本教程进行操作,由于某种原因,我收到“最大调用堆栈错误”
<template>
<SearchInput></SearchInput>
</template>
<script>
import SearchInput from './components/SearchInput.vue'
export default {
name: 'App',
components:{
SearchInput
}
};
</script>
Run Code Online (Sandbox Code Playgroud)
SearchInput.vue组件文件:
<template>
<SearchInput>
<input type="text">
</SearchInput>
</template>
<script>
export default {
name: "SearchInput",
}
</script>
Run Code Online (Sandbox Code Playgroud)
我尝试为 SearchInput 指定自己的名称“SearchInputView”:SearchInput 但它不起作用。我使用 es6 语法,这是一个 Vue 2 项目。我究竟做错了什么?