sequelize/sequelize

Need a VARBINARY data type

開放

#5,981 建立於 2016年5月28日

 (13 則留言) (0 個反應) (0 位負責人)TypeScript (4,271 個分叉)batch import
P4: nice to havedialect: mysqlgood first issuestatus: understood

倉庫指標

星標
 (29,527 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

Sequelize currently doesn't have a native string type that maps to an easily indexable VARBINARY in MySQL.

This is going to be a growing issue due to utf8mb4, under which the practice (that Sequelize also uses) of using VARCHAR(255) and InnoDB leads to indexes that are too large and cause CREATE TABLE to fail. With the new charset limitations, some columns will simply use a smaller index size; while others will be better off using a VARBINARY. For example, a sorted title index would likely be better off with a utf8mb4 index with a smaller size and a column storing the string identifier for a facebook/google/etc... account would be best off switching to a VARBINARY.

Note that STRING.BINARY will not work because that is for VARCHAR(255) BINARY which still use utf8mb4 and just use the _bin charset, they still use 4 bytes per character in indexes. Also BLOB makes for indexing issues, our inherent problem.

Naming ideas: STRING.RAW, VARBINARY

This should be relatively simple for someone who knows how data-types.js works to do. I can't submit a patch set since I don't understand enough about how the oids in the pg data-types.js file works.

貢獻者指南