-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Closed
Description
Issue type: bug report
Database system/driver: postgres
TypeORM version: 0.2.6 as reported by
$ typeorm version
Local installed version: 0.2.6
Global installed TypeORM version: 0.2.6
Steps to reproduce or a small repository showing the problem:
The cause seems to be this entity:
enum State {
Running = 0,
Completed = 1,
}
@Entity('presence_list_item')
export class Presence {
@PrimaryGeneratedColumn('uuid')
public id!: string
@Column('enum', {nullable: false})
public state!: State
}And TypeORM dies when I attempt to sync the schema:
$ typeorm schema:sync
query: START TRANSACTION
query: SELECT * FROM current_schema()
query: SELECT * FROM "information_schema"."tables" WHERE ...
query: SELECT "ns"."nspname" AS "table_schema", "t"."relname" AS "table_name", "cnst"."conname" AS "constraint_name", "cnst"."consrc" AS "expression", CASE "cnst"."contype" WHEN 'p' THEN 'PRIMARY' WHEN 'u' THEN 'UNIQUE' WHEN 'c' THEN 'CHECK' END AS "constraint_type", "a"."attname" AS "column_name" FROM "pg_constraint" "cnst" INNER JOIN "pg_class" "t" ON "t"."oid" = "cnst"."conrelid" INNER JOIN "pg_namespace" "ns" ON "ns"."oid" = "cnst"."connamespace" INNER JOIN "pg_attribute" "a" ON "a"."attrelid" = "cnst"."conrelid" AND "a"."attnum" = ANY ("cnst"."conkey") WHERE ...
query: SELECT "ns"."nspname" AS "table_schema", "t"."relname" AS "table_name", "i"."relname" AS "constraint_name", "a"."attname" AS "column_name", CASE "ix"."indisunique" WHEN 't' THEN 'TRUE' ELSE'FALSE' END AS "is_unique", pg_get_expr("ix"."indpred", "ix"."indrelid") AS "condition" FROM "pg_class" "t" INNER JOIN "pg_index" "ix" ON "ix"."indrelid" = "t"."oid" INNER JOIN "pg_attribute" "a" ON "a"."attrelid" = "t"."oid" AND "a"."attnum" = ANY ("ix"."indkey") INNER JOIN "pg_namespace" "ns" ON "ns"."oid" = "t"."relnamespace" INNER JOIN "pg_class" "i" ON "i"."oid" = "ix"."indexrelid" LEFT JOIN "pg_constraint" "cnst" ON "cnst"."conname" = "i"."relname" WHERE ...
query: SELECT "con"."conname" AS "constraint_name", "con"."nspname" AS "table_schema", "con"."relname" AS "table_name", "att2"."attname" AS "column_name", "ns"."nspname" AS "referenced_table_schema", "cl"."relname" AS "referenced_table_name", "att"."attname" AS "referenced_column_name", "con"."confdeltype" AS "on_delete", "con"."confupdtype" AS "on_update" FROM ( SELECT UNNEST ("con1"."conkey") AS "parent", UNNEST ("con1"."confkey") AS "child", "con1"."confrelid", "con1"."conrelid", "con1"."conname", "con1"."contype", "ns"."nspname", "cl"."relname", CASE "con1"."confdeltype" WHEN 'a' THEN 'NO ACTION' WHEN 'r' THEN 'RESTRICT' WHEN 'c' THEN 'CASCADE' WHEN 'n' THEN 'SET NULL' WHEN 'd' THEN 'SET DEFAULT' END as "confdeltype", CASE "con1"."confupdtype" WHEN 'a' THEN 'NO ACTION' WHEN 'r' THEN 'RESTRICT' WHEN 'c' THEN 'CASCADE' WHEN 'n' THEN 'SET NULL' WHEN 'd' THEN 'SET DEFAULT' END as "confupdtype" FROM "pg_class" "cl" INNER JOIN "pg_namespace" "ns" ON "cl"."relnamespace" = "ns"."oid" INNER JOIN "pg_constraint" "con1" ON "con1"."conrelid" = "cl"."oid" WHERE ...
...
creating a new table: presence_list_item
query: SELECT "n"."nspname", "t"."typname" FROM "pg_type" "t" INNER JOIN "pg_namespace" "n" ON "n"."oid" = "t"."typnamespace" WHERE "n"."nspname" = current_schema() AND "t"."typname" = 'presence_list_item_state_enum'
query: ROLLBACK
Error during schema synchronization:
TypeError: Cannot read property 'map' of undefined
at PostgresQueryRunner.createEnumTypeSql (~/lib/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:2046:38)
at PostgresQueryRunner.<anonymous> (~/lib/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:447:69)
at step (~/lib/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:42:23)
at Object.next (~/lib/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:23:53)
at fulfilled (~/lib/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:14:58)
at process._tickCallback (internal/process/next_tick.js:68:7)
Reactions are currently unavailable