uranusjr commented on code in PR #24044:
URL: https://github.com/apache/airflow/pull/24044#discussion_r886154632
##########
airflow/migrations/env.py:
##########
@@ -51,7 +54,20 @@ def include_object(_, name, type_, *args):
# my_important_option = config.get_main_option("my_important_option")
# ... etc.
-COMPARE_TYPE = False
+
+def compare_type(context, inspected_column, metadata_column, inspected_type,
metadata_type):
+ # return False if the metadata_type is the same as the inspected_type
+ # or None to allow the default implementation to compare these
+ # types. a return value of True means the two types do not
+ # match and should result in a type change operation.
+ if isinstance(inspected_type, DATETIME) and isinstance(metadata_type,
UtcDateTime):
+ # for sqlite
+ return False
+ if isinstance(inspected_type, mysql.VARCHAR) and isinstance(metadata_type,
String):
+ # This is a hack to get around MySQL VARCHAR collation
+ # not being possible to change from utf8_bin to utf8mb3_bin
+ return False
Review Comment:
Would it be possible to do these only on corresponding databases? I _think_
the info is available on `context`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]