Skip to content

[BUG]: drizzle-kit pull fails with Error: Unknown table 'check_constraints' in information_schema #3494

Description

Report hasn't been filed before.

  • I have verified that the bug I'm about to report hasn't been filed before.

What version of drizzle-orm are you using?

0.36.0

What version of drizzle-kit are you using?

0.27.1

Other packages

No response

Describe the Bug

What is the undesired behavior?

drizzle-kit fails to pull schema from MySQL DB

Error message:

❯ npx drizzle-kit pull
No config path provided, using default 'drizzle.config.ts'
Reading config file '<REDACTED>\drizzle.config.ts'
Pulling from ['public'] list of schemas

[✓] 540  tables fetched
[✓] 4476 columns fetched
[✓] 1763 indexes fetched
[✓] 691  foreign keys fetched
[⣯] 0    policies fetching
[⣯] 0    check constraints fetching
[✓] 0    views fetched
Error: Unknown table 'check_constraints' in information_schema
    at PromiseConnection.execute (<REDACTED>\node_modules\mysql2\promise.js:112:22)
    at Object.query (<REDACTED>\node_modules\drizzle-kit\bin.cjs:65548:40)
    at fromDatabase (<REDACTED>\node_modules\drizzle-kit\bin.cjs:18956:41)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ER_UNKNOWN_TABLE',
  errno: 1109,
  sql: 'SELECT \n' +
    '    tc.table_name, \n' +
    '    tc.constraint_name, \n' +
    '    cc.check_clause\n' +
    'FROM \n' +
    '    information_schema.table_constraints tc\n' +
    'JOIN \n' +
    '    information_schema.check_constraints cc \n' +
    '    ON tc.constraint_name = cc.constraint_name\n' +
    'WHERE \n' +
    "    tc.constraint_schema = '<REDACTED>'\n" +
    'AND \n' +
    "    tc.constraint_type = 'CHECK';",
  sqlState: '42S02',
  sqlMessage: "Unknown table 'check_constraints' in information_schema"
}

What are the steps to reproduce it?

npx drizzle-kit pull

What is the desired result?

The command should complete successfully

What database engine are you using? Are you using a specific cloud provider? Which one?

Engine version: 8.0.mysql_aurora.3.05.2
Cloud Provider: AWS

Do you think this bug pertains to a specific database driver? Which one?

Unknown. I suspect MySQL only

Are you working in a monorepo?

No

If this is a bug related to types: What Typescript version are you using? What's the content of your tsconfig.json file?

N/A

If you're using a runtime that isn't Node.js: Which one? What version? Have you verified that this isn't an issue with the runtime itself?

N/A; using node v20.17.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions