Skip to content

cockrachdb: DROP TYPE CASCADE is not yet supported #9127

@simplenotezy

Description

@simplenotezy

Issue Description

When using cockroachdb with enums the app won't work - despite syncronize is disabled. It tries to create an enum type, and uses DROP CASCADE, which is not supported by cockroachdb.

Expected Behavior

Ability to disable DROP TYPE IF EXISTS .... CASCADE - I'd like to write the migrations/database schema myself entirely.

If I could use the cockroachdb driver, it would be better: #9068

Actual Behavior

query failed: DROP TYPE IF EXISTS "public"."gender_enum" CASCADE;
error: error: unimplemented: DROP TYPE CASCADE is not yet supported
    at Parser.parseErrorMessage (/Users/me/Projects/project/backend/node_modules/pg-protocol/src/parser.ts:369:69)
    at Parser.handlePacket (/Users/me/Projects/project/backend/node_modules/pg-protocol/src/parser.ts:188:21)
    at Parser.parse (/Users/me/Projects/project/backend/node_modules/pg-protocol/src/parser.ts:103:30)
    at Socket.<anonymous> (/Users/me/Projects/project/backend/node_modules/pg-protocol/src/index.ts:7:48)
    at Socket.emit (node:events:526:28)
    at Socket.emit (node:domain:475:12)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
  length: 213,
  severity: 'ERROR',
  code: '0A000',
  detail: undefined,
  hint: 'You have attempted to use a feature that is not yet implemented.\n' +
    'See: https://go.crdb.dev/issue-v/51480/v22.1',
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'drop_type.go',
  line: '53',
  routine: 'DropType'
}

Steps to Reproduce

  1. Create an entity
  2. Assign an custom enum type to the entity
  3. Set the driver to postgres (otherwise will it simply complain with: Data type "enum" in "User.gender" is not supported by "cockroachdb" #9068)
export enum Gender {
  Male = 'Male',
  Female = 'Female',
  NonBinary = 'NonBinary',
}

@Column({
  type: 'enum',
  enum: Gender,
  nullable: true,
})
@Index()
gender: Gender;

My Environment

Dependency Version
Operating System
Node.js version v16.14.2
Typescript version 4.6.3
TypeORM version 0.3.6

Relevant Database Driver(s)

DB Type Reproducible
aurora-mysql no
aurora-postgres no
better-sqlite3 no
cockroachdb no
cordova no
expo no
mongodb no
mysql no
nativescript no
oracle no
postgres yes
react-native no
sap no
spanner no
sqlite no
sqlite-abstract no
sqljs no
sqlserver no

Are you willing to resolve this issue by submitting a Pull Request?

  • ✖️ Yes, I have the time, and I know how to start.
  • ✅ Yes, I have the time, but I don't know how to start. I would need guidance.
  • ✅ No, I don’t have the time, but I can support (using donations) development.
  • ✖️ No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions