You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/06/19 17:13:05 UTC

[GitHub] [airflow] dossett commented on a change in pull request #5418: [AIRFLOW-3036] Updates for MYSQL migrations

dossett commented on a change in pull request #5418: [AIRFLOW-3036] Updates for MYSQL migrations
URL: https://github.com/apache/airflow/pull/5418#discussion_r295410944
 
 

 ##########
 File path: airflow/migrations/versions/0a2a5b66e19d_add_task_reschedule_table.py
 ##########
 @@ -66,13 +66,14 @@ def upgrade():
         sa.Column('id', sa.Integer(), nullable=False),
         sa.Column('task_id', sa.String(length=250), nullable=False),
         sa.Column('dag_id', sa.String(length=250), nullable=False),
-        # use explicit server_default=None otherwise mysql implies defaults for first timestamp column
-        sa.Column('execution_date', timestamp(), nullable=False, server_default=None),
+        sa.Column('execution_date', timestamp(), nullable=False,
+                  server_default=sa.text('CURRENT_TIMESTAMP(6)')),
         sa.Column('try_number', sa.Integer(), nullable=False),
-        sa.Column('start_date', timestamp(), nullable=False),
-        sa.Column('end_date', timestamp(), nullable=False),
+        sa.Column('start_date', timestamp(), nullable=False, server_default=sa.text('CURRENT_TIMESTAMP(6)')),
+        sa.Column('end_date', timestamp(), nullable=False, server_default=sa.text('CURRENT_TIMESTAMP(6)')),
 
 Review comment:
   I'm not a Mysql expert by any means, but I understand the issue to be that if you specify a timestamp to column to be not null you have to supply a default value.  Given the model also knows that it's not null it *should* be the case that we never have to rely on the database's default?
   
   Is the current_timestamp better or worse that any other default that could be used at the database level?
   
   Maybe another option is to require mysql to use this flag? https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_explicit_defaults_for_timestamp
   
   No idea how feasible that would be.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services