Cannot parse the BINARY token
Closed this issue · 1 comments
from https://github.com/ronaldbradford/schema
CREATE TABLE administrators (
id int NOT NULL auto_increment,
user_name varchar(255) binary NOT NULL,
user_password varchar(60) NOT NULL,
PRIMARY KEY (id)
);
user_name varchar(255) binary ^
Unexpected K_BINARY token: "binary". Instead, I was expecting to see one of the following:
CREATE TABLE staff (
staff_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
first_name VARCHAR(45) NOT NULL,
last_name VARCHAR(45) NOT NULL,
address_id SMALLINT UNSIGNED NOT NULL,
picture BLOB DEFAULT NULL,
email VARCHAR(50) DEFAULT NULL,
store_id TINYINT UNSIGNED NOT NULL,
active BOOLEAN NOT NULL DEFAULT TRUE,
username VARCHAR(16) NOT NULL,
password VARCHAR(40) BINARY DEFAULT NULL,
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (staff_id),
KEY idx_fk_store_id (store_id),
KEY idx_fk_address_id (address_id),
CONSTRAINT fk_staff_store FOREIGN KEY (store_id) REFERENCES store (store_id) ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT fk_staff_address FOREIGN KEY (address_id) REFERENCES address (address_id) ON DELETE RESTRICT ON UPDATE CASCADE
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
password VARCHAR(40) BINARY ^
Unexpected K_BINARY token: "BINARY". Instead, I was expecting to see one of the following:
https://dev.mysql.com/doc/refman/5.7/en/binary-varbinary.html
It seems that the package cannot interpret the BINARY token.
Hi @youngkiu
Thank you for using this package!
This is now fixed in v4.0.7.
Please note that the link you provided is about the binary/varbinary datatypes, which is different from varchar(255) binary
. The latter is a shorthand for setting the varchar column character collation to the binary type (https://dev.mysql.com/doc/refman/8.0/en/charset-binary-collations.html).
It's hard to find about this shorthand because its usage is deprecated:
The resulting column is:
Regards.