最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

sequelize.js - Sequelize Snowflake (v7 alpha) TypeError when syncing a model - Stack Overflow

programmeradmin5浏览0评论

I'm getting a Type error when trying to sync a model with @sequelize/snowflake ( "@sequelize/core": "^7.0.0-alpha.42", "@sequelize/snowflake": "^7.0.0-alpha.45"). I'm aware that the Snowflake dialect is community maintained. I am using Fastify.

Model:

@Table({
    tableName: "EXAMPLE",
    timestamps: false,
    underscored: true,
})
export class Example extends Model<
    InferAttributes<Example>,
    InferCreationAttributes<Example>
> {
    @Attribute(DataTypes.STRING)
    @PrimaryKey
    @ColumnName("TEST")
    declare test: string;
    ...
TypeError: Expected type to be a string, a DataType class, or a DataType instance, but got STRING {
  usageContext: undefined,
  options: { length: undefined, binary: false }
}.
    at normalizeDataType (/app/node_modules/@sequelize/core/src/abstract-dialect/data-types-utils.ts:47:11)
    at Sequelize.normalizeDataType (/app/node_modules/@sequelize/core/src/sequelize-typescript.ts:1212:12)
    at Sequelize.validateValue (/app/node_modules/@sequelize/core/src/sequelize-typescript.ts:1200:17)
at SnowflakeQueryGenerator.escape (/app/node_modules/@sequelize/snowflake/node_modules/@sequelize/core/src/abstract-dialect/query-generator-typescript.ts:867:20)
    at SnowflakeQueryGenerator.tableExistsQuery (/app/node_modules/@sequelize/snowflake/node_modules/@sequelize/core/src/abstract-dialect/query-generator-typescript.ts:918:118)
    at SnowflakeQueryInterface.tableExists (/app/node_modules/@sequelize/snowflake/node_modules/@sequelize/core/src/abstract-dialect/query-interface-typescript.ts:332:37)
    at Function.sync (/app/node_modules/@sequelize/core/src/model.js:873:47)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async <anonymous> (/app/src/plugins/sequelize.ts:20:3)
发布评论

评论列表(0)

  1. 暂无评论