Redshift - 使用 node-orm-2 自动递增 ID 的类型 "serial" 不受支持

Redshift - unsupported type "serial" for auto increment id with node-orm-2

对如何使自动递增 ID 起作用有任何见解吗?据我了解,默认情况下会添加一个 id 列;但是,因为我使用的是 Redshift,默认的 "serial" 类型将无法使用,因为它不受支持。

{ [error: Column "probe.id" has unsupported type "serial".]
  name: 'error',
  length: 165,
  severity: 'ERROR',
  code: '0A000',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: '/home/awsrsqa/padb/src/pg/src/backend/parser/parser_analyze.c',
  line: '3600',
  routine: 'transformColumnDefinition',
  model: 'probe' }

不支持这样的东西。

你只能得到一个auto-increment for an integer:

IDENTITY(seed, step) Clause that specifies that the column is an IDENTITY column. An IDENTITY column contains unique auto-generated values. These values start with the value specified as seed and increment by the number specified as step. The data type for an IDENTITY column must be either INT or BIGINT.

对于 GUID,您必须生成一个并自行插入。

示例:

CREATE TABLE your_table(
   id INT IDENTITY(1, 1)
);