简体   繁体   中英

mysql 5.6: remove explicit column collate

I am running mysql 5.6.

Some of the columns in a schema that I inherited from previous developers have an explicitly specified collate clause.

All explicitly specified collate clauses are the same as the database's default collate .

Is there any way to remove the explicit column collate clauses?

There should be no functional collating differences versus my current collate , but I want the following:

  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)

  2. to have the collate of these columns automatically change to whatever is the new default database collate if I ever change it

1) is much more important than 2), however, since I will probably never change the collate again.

Thanks.

Instead of using SHOW CREATE TABLE , fetch the equivalent data from information_schema tables TABLES and COLUMNS .

Meanwhile, do you have an example of the COLLATION clause being present in some cases, but not in other cases?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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