【问题标题】:Adding a `updatedDate` column in TypeORM without using the Typescript decorator `@UpdateDateColumn`在 TypeORM 中添加 `updatedDate` 列而不使用 Typescript 装饰器`@UpdateDateColumn`
【发布时间】:2021-02-18 07:57:19
【问题描述】:

我在一个项目中使用 Javascript,如果不使用 Typescript @UpdateDateColumn 装饰器,我无法弄清楚如何包含 updatedDate 列。

在打字稿中:

  @UpdateDateColumn()
  updatedDate: Date // works perfectly but unfortunately I am not using TS in this project

在 Javascript 中:

    createdDate: {
      type: 'timestamp', // works fine
    },
    updatedDate: {
      type: 'timestamp', // throws error + everything else I have tried has also thrown an error.
    },

【问题讨论】:

    标签: javascript mysql sql typescript typeorm


    【解决方案1】:
        updatedDate: {
          type: 'time', // works!!!
        },
    

    【讨论】:

      猜你喜欢
      • 2021-03-11
      • 1970-01-01
      • 2021-09-15
      • 2020-07-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-08
      • 1970-01-01
      相关资源
      最近更新 更多