Skip to content
This repository was archived by the owner on Jan 12, 2022. It is now read-only.

TEXT column can't have a default value #251

@pp2amd6

Description

@pp2amd6

What version of Node.js are you using?

v12.22.6

What version of npm are you using?

6.14.15

What operating system are you using?

CentOS Linux release 7.9.2009

Describe the Bug

When I run a "pure" CAD in the console, I get errors:
0|CAD | Error: ER_BLOB_CANT_HAVE_DEFAULT: BLOB, TEXT, GEOMETRY or JSON column 'data' can't have a default value
0|CAD | at Query.Sequence._packetToError (/var/www/snaily-cadv3/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
0|CAD | at Query.ErrorPacket (/var/www/snaily-cadv3/node_modules/mysql/lib/protocol/sequences/Query.js:79:18)
0|CAD | at Protocol._parsePacket (/var/www/snaily-cadv3/node_modules/mysql/lib/protocol/Protocol.js:291:23)
0|CAD | at Parser._parsePacket (/var/www/snaily-cadv3/node_modules/mysql/lib/protocol/Parser.js:433:10)
0|CAD | at Parser.write (/var/www/snaily-cadv3/node_modules/mysql/lib/protocol/Parser.js:43:10)
0|CAD | at Protocol.write (/var/www/snaily-cadv3/node_modules/mysql/lib/protocol/Protocol.js:38:16)
0|CAD | at Socket. (/var/www/snaily-cadv3/node_modules/mysql/lib/Connection.js:88:28)
0|CAD | at Socket. (/var/www/snaily-cadv3/node_modules/mysql/lib/Connection.js:526:10)
0|CAD | at Socket.emit (events.js:314:20)
0|CAD | at addChunk (_stream_readable.js:297:12)
0|CAD | at readableAddChunk (_stream_readable.js:272:9)
0|CAD | at Socket.Readable.push (_stream_readable.js:213:10)
0|CAD | at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
0|CAD | --------------------
0|CAD | at Protocol._enqueue (/var/www/snaily-cadv3/node_modules/mysql/lib/protocol/Protocol.js:144:48)
0|CAD | at Connection.query (/var/www/snaily-cadv3/node_modules/mysql/lib/Connection.js:198:25)
0|CAD | at /var/www/snaily-cadv3/node_modules/@casper124578/mysql.ts/dist/QueryBuilder.js:236:29
0|CAD | at new Promise ()
0|CAD | at QueryBuilder.exec (/var/www/snaily-cadv3/node_modules/@casper124578/mysql.ts/dist/QueryBuilder.js:234:16)
0|CAD | at processQuery (/var/www/snaily-cadv3/dist/src/lib/database.js:30:59)
0|CAD | at async updateLine (/var/www/snaily-cadv3/dist/src/lib/database.js:45:9) {
0|CAD | code: 'ER_BLOB_CANT_HAVE_DEFAULT',
0|CAD | errno: 1101,
0|CAD | sqlMessage: "BLOB, TEXT, GEOMETRY or JSON column 'data' can't have a default value",
0|CAD | sqlState: '42000',
0|CAD | index: 0,
0|CAD | sql: '\n' +
0|CAD | ' CREATE TABLE mugshots (\n' +
0|CAD | ' id varchar(255) NOT NULL,\n' +
0|CAD | ' citizen_id varchar(255) NOT NULL,\n' +
0|CAD | " data text NOT NULL DEFAULT '[]',\n" +
0|CAD | ' officer_name varchar(255) NOT NULL,\n' +
0|CAD | ' full_date text NOT NULL,\n' +
0|CAD | ' officer_id varchar(255) NOT NULL,\n' +
0|CAD | ' PRIMARY KEY (id)\n' +
0|CAD | ' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;\n' +
0|CAD | ' '
0|CAD | }

The default values for TEXT and BLOB are described in the official MySQL documentation: https://dev.mysql.com/doc/refman/8.0/en/blob.html

The problem with tables:

  • seo_tags
  • mugshots

Expected Behavior

Don't get errors :)

To Reproduce

Just run a "clean" CAD

Metadata

Metadata

Assignees

Labels

Added/fixed in devFixed or added in developmentbugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions