简体   繁体   English

mysql 5.6:删除显式列整理

[英]mysql 5.6: remove explicit column collate

I am running mysql 5.6. 我正在运行mysql 5.6。

Some of the columns in a schema that I inherited from previous developers have an explicitly specified collate clause. 我从先前开发人员继承的模式中的某些列具有明确指定的collate子句。

All explicitly specified collate clauses are the same as the database's default collate . 所有明确指定的collate子句都与数据库的默认collate

Is there any way to remove the explicit column collate clauses? 有没有办法删除显式列collate子句?

There should be no functional collating differences versus my current collate , but I want the following: 与我目前的collate相比,应该没有功能整理差异,但我想要以下内容:

  1. to get column definitions sans collate clauses when I request a create table statement from mysql (I want to be able to compare table creation scripts from a code repository with create table statements obtained from different instances of the schema on different mysql servers; the explicit column collate clauses are only in some instances, but not others, which would require me to use a more complex diff than a plain text diff) 从mysql请求create table语句时获取列定义sans collate子句(我希望能够将来自代码存储库的表创建脚本与从不同mysql服务器上的模式的不同实例获取的create table语句进行比较;显式列collate子句仅在某些情况下,而不是其他情况,这将要求我使用比纯文本diff更复杂的diff

  2. to have the collate of these columns automatically change to whatever is the new default database collate if I ever change it 如果我更改它, collate这些列的collate自动更改为新的默认数据库collate

1) is much more important than 2), however, since I will probably never change the collate again. 1)比2)重要得多,但是,因为我可能永远不会再次改变collate

Thanks. 谢谢。

Instead of using SHOW CREATE TABLE , fetch the equivalent data from information_schema tables TABLES and COLUMNS . 而不是使用SHOW CREATE TABLE ,从information_schemaTABLESCOLUMNS获取等效数据。

Meanwhile, do you have an example of the COLLATION clause being present in some cases, but not in other cases? 同时,你有一个例子,在某些情况下会出现COLLATION子句,但在其他情况下却没有吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM