Skip to content

TypeError: Cannot read property 'replace' of undefined #97

@pardeike

Description

@pardeike

I get the following error:

$ schemats generate -c mysql://local:local@localhost/Signing -t Logs -o Logs.ts
TypeError: Cannot read property 'replace' of undefined
    at Function.MysqlDatabase.parseMysqlEnumeration (/Users/ap/.nvm/versions/node/v8.11.3/lib/node_modules/schemats/src/schemaMysql.js:119:26)
    at /Users/ap/.nvm/versions/node/v8.11.3/lib/node_modules/schemats/src/schemaMysql.js:149:60
    at Array.forEach (<anonymous>)
    at MysqlDatabase.<anonymous> (/Users/ap/.nvm/versions/node/v8.11.3/lib/node_modules/schemats/src/schemaMysql.js:147:40)
    at step (/Users/ap/.nvm/versions/node/v8.11.3/lib/node_modules/schemats/src/schemaMysql.js:32:23)
    at Object.next (/Users/ap/.nvm/versions/node/v8.11.3/lib/node_modules/schemats/src/schemaMysql.js:13:53)
    at fulfilled (/Users/ap/.nvm/versions/node/v8.11.3/lib/node_modules/schemats/src/schemaMysql.js:4:58)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

I just installed schemats with npm install -g schemats

$ type schemats
schemats is hashed (/Users/ap/.nvm/versions/node/v8.11.3/bin/schemats)

and my table looks like this:

mysql> use Signing;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> describe Logs;
+---------+------------------------------------------------+------+-----+-------------------+----------------+
| Field   | Type                                           | Null | Key | Default           | Extra          |
+---------+------------------------------------------------+------+-----+-------------------+----------------+
| id      | int(10) unsigned                               | NO   | PRI | NULL              | auto_increment |
| tstamp  | timestamp                                      | YES  | MUL | CURRENT_TIMESTAMP |                |
| user    | char(8)                                        | YES  | MUL | NULL              |                |
| session | int(10) unsigned                               | YES  | MUL | NULL              |                |
| level   | enum('debug','info','warn','error','critical') | NO   |     | NULL              |                |
| text    | text                                           | YES  |     | NULL              |                |
+---------+------------------------------------------------+------+-----+-------------------+----------------+
6 rows in set (0.00 sec)

My database installation:

mysql> status
--------------
mysql  Ver 8.0.11 for osx10.13 on x86_64 (Homebrew)

Connection id:		23
Current database:	signing
Current user:		local@localhost
SSL:			Not in use
Current pager:		stdout
Using outfile:		''
Using delimiter:	;
Server version:		8.0.11 Homebrew
Protocol version:	10
Connection:		Localhost via UNIX socket
Server characterset:	utf8
Db     characterset:	utf8
Client characterset:	utf8mb4
Conn.  characterset:	utf8mb4
UNIX socket:		/tmp/mysql.sock
Uptime:			2 hours 38 min 35 sec

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions