postgres 不支持 TypeORM 数组? [英] TypeORM array is not supported in postgres?

查看:89
本文介绍了postgres 不支持 TypeORM 数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一列kid_ages,它是Integer[].迁移时,我收到以下错误:

I have a column kid_ages which is Integer[]. When migrating, I get the following error:

DataTypeNotSupportedError:数据类型数组"在home.kid_ages"中postgres"不支持数据库.

我尝试在我的专栏中添加以下选项:

I tried adding the following options to my column:

type: 'array'

和:

array: true,
default: [],
nullable: false,`

@Column({
  array: true,
  default: [],
  nullable: false,
})
kid_ages: string;`

推荐答案

文档说,它应该可以工作:

The docs says, that it should work:

@Column("int", { array: true })
array: number[];

这是来自示例 https://github.com/typeorm/typeorm/blob/master/test/functional/database-schema/column-types/postgres/entity/Post.ts

在您的代码中,数组属性不是数组.你试过 kid_ages: string[]; 吗?

In your code the array property is no array. Have you tried kid_ages: string[];?

这篇关于postgres 不支持 TypeORM 数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆