- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当尝试在我的 heroku-postgres 数据库中撤消 sequelize 迁移时,我得到 SequelizeDatabaseError
,因为 ENUM 类型应该不存在。
我有几个带有 ENUM 数据类型的表/模型。在向下迁移中,我尝试删除表,然后也删除表的关联枚举数据类型。到目前为止,似乎只有一种迁移适用于两个方向。
我尝试手动删除每种类型,然后全部迁移,然后全部撤消,但在相同的模型上总是失败,说 ENUM 类型不存在(当它们显然是在向上迁移中创建时)。
这是一个向下迁移失败的模型。
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('PatientContacts', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
phoneHome: {
type: Sequelize.STRING,
allowNull: true,
},
phoneWork: {
type: Sequelize.STRING,
allowNull: true,
},
phoneMobile: {
type: Sequelize.STRING,
allowNull: false,
},
phonePreferred: {
type: Sequelize.ENUM,
values: ['Home','Work','Mobile', null]
},
smsNotifications: {
type: Sequelize.ENUM,
values: [true, false, null]
},
email: {
type: Sequelize.STRING,
allowNull: true,
},
emailConsent: {
type: Sequelize.ENUM,
values: [true, false, null]
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('PatientContacts')
.then(() => queryInterface.sequelize.query('DROP TYPE "public"."enum_PatientContacts_emailConsent;"'))
.then(() => queryInterface.sequelize.query('DROP TYPE "public"."enum_PatientContacts_phonePreferred;"'))
.then(() => queryInterface.sequelize.query('DROP TYPE "public"."enum_PatientContacts_smsNotifications;"'))
.catch(err => {
console.log(err);
throw new Error(err);
})
}
};
Error: SequelizeDatabaseError: type "public.enum_PatientContacts_emailConsent;" does not exist
at queryInterface.dropTable.then.then.then.catch.err (/app/migrations/20181213023202-create-PatientContact.js:56:13)
at tryCatcher (/app/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/app/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/app/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/app/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/app/node_modules/bluebird/js/release/promise.js:690:18)
at _drainQueueStep (/app/node_modules/bluebird/js/release/async.js:138:12)
at _drainQueue (/app/node_modules/bluebird/js/release/async.js:131:9)
at Async._drainQueues (/app/node_modules/bluebird/js/release/async.js:147:5)
at Immediate.Async.drainQueues [as _onImmediate] (/app/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:693:18)
at tryOnImmediate (timers.js:664:5)
at processImmediate (timers.js:646:5)
最佳答案
我很失望我在这个问题上被困了几个小时。
结束原始查询的分号应该出现在结束类型名称的双引号之后,但在结束整个 sql 查询本身的单引号之前。
关于javascript - SequelizeDatabaseError : dropping non-existent ENUM types, 但它们确实存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54301911/
我要选择column1小于或等于 column2 的数据.但是,当我尝试使用 { console.log(notify) res.render('index', { title
我在页面中有一个更新面板,供用户指定事件的“所有者”。该所有者将是我们事件目录中的用户。该面板允许用户输入一些文本,然后单击搜索按钮以在我们的 Active Directory 中查找匹配的用户。当用
我想知道为什么同一个实体在控制台中调用的浏览器 window 对象中有不同的表示: 如果我们仅在浏览器控制台内调用window,我们将获得完整的浏览器信息。其中文档将表示为类似对象的实体,包括各种 P
我有一个正在处理大量数据的应用程序,我正在监视它的 .NET 内存性能计数器。基于性能计数器,所有堆中的#Bytes 正在缓慢增长(每 12 小时约 20MB)。所有 3 代也被收集(gen0 每秒几
According to documentation 默认实现不执行任何操作。 但是...我从 drawRect 方法中抛出异常并且我看到了下一个调用堆栈 3 EasyWakeup
我使用 package maven 插件构建了一个 Spring 应用程序的 jar。在本地,我可以运行它java -jar -Dspring.profiles.active=dev target/m
我们正在开发一种软件,我们可以在其中预览和记录从视频采集卡采集的输入视频源。预览是用DirectShow实现的,录制是用Media Foundation实现的(老软件慢慢升级到MediaFound
我在 symfony 中构建了一个简单的操作,它通过 wkhtmltopdf 生成一个 PDF 文件并将其输出到浏览器。 代码如下: $response = $this->getResponse(
这将是一个简短的问题。 来源在这里:https://github.com/exhuma/grc 标题解释了我的问题;) 我注册并上传了包到pypi。现在,如果我运行 easy_install grc,
我需要将事务与LINQ to SQL一起使用,并且正在阅读以熟悉它。 确实已处理SubmitChanges吗? 最佳答案 当您调用SubmitChanges时,LINQ to SQL将检查一组已知对象
在 Ajax 结果之后,我试图淡出 html 按钮。这在大多数情况下都有效,但有时按钮不会淡出,我不明白为什么。 $.ajax({ type: frm.attr('method'),
我以这样的方式创建 Cesium.Primitive: _createPrimitive: function (linesNumber) { var instances = [
我正在 Spring 上构建一个 Web 应用程序。 我很困惑是否应该在配置中使用 mvc:annotation-driven 还是 context:annotation-config 来扫描注释来处
问题 - 给定一个字符串 '0'、'1' 和 '?'。生成所有可能的字符串,您可以在其中替换“?”用“0”或“1”? 例如 - 输入 - “0??” 输出 - “000”、“001”、“010”、“0
总结: 修改wxwidgets Hello World tutorial中的代码后在 CppMicroServices 框架中的“模块”中,使用事件表或 Bind() 注册的事件似乎不会触发,但使用
我的 Capistrano 任务失败了 No such file or directory @ rb_sysopen - /home/blog/pids/grantb.blog.staging.pid
我们在 repo 协议(protocol)中有一个配置文件,所有用户都根据他们的功能做出贡献。对于我的本地测试,我需要手动更改该配置文件中的两个值,但我不想将我的更改提交回服务器。 但是,如果存储库中
我在顶部菜单(ListItems)的开头插入一个菜单选项并使用 $('#newMenuItem').show('slide'); 成功了。但是,我不喜欢它从左上角滑入的方式,所以我将其更改为 $('#
我尝试在我的 NSWindow 上调用 setFrame:display:animate: 并且没有执行任何操作,但是如果我在同一个窗口上调用 setFrame:display:,它有效。 我需要做其
我是一名优秀的程序员,十分优秀!