diff --git a/airflow/migrations/versions/03afc6b6f902_increase_length_of_fab_ab_view_menu_.py b/airflow/migrations/versions/03afc6b6f902_increase_length_of_fab_ab_view_menu_.py index aeb5665e9b34a..f7484bf979c83 100644 --- a/airflow/migrations/versions/03afc6b6f902_increase_length_of_fab_ab_view_menu_.py +++ b/airflow/migrations/versions/03afc6b6f902_increase_length_of_fab_ab_view_menu_.py @@ -28,6 +28,8 @@ from alembic import op from sqlalchemy.engine.reflection import Inspector +from airflow.models.base import COLLATION_ARGS + # revision identifiers, used by Alembic. revision = '03afc6b6f902' down_revision = '92c57b58940d' @@ -59,7 +61,10 @@ def upgrade(): op.execute("PRAGMA foreign_keys=on") else: op.alter_column( - table_name='ab_view_menu', column_name='name', type_=sa.String(length=250), nullable=False + table_name='ab_view_menu', + column_name='name', + type_=sa.String(length=250, **COLLATION_ARGS), + nullable=False, ) diff --git a/airflow/migrations/versions/0a2a5b66e19d_add_task_reschedule_table.py b/airflow/migrations/versions/0a2a5b66e19d_add_task_reschedule_table.py index 33e89b3cb86af..2133eb148c30b 100644 --- a/airflow/migrations/versions/0a2a5b66e19d_add_task_reschedule_table.py +++ b/airflow/migrations/versions/0a2a5b66e19d_add_task_reschedule_table.py @@ -26,9 +26,9 @@ from alembic import op from sqlalchemy.dialects import mysql -# revision identifiers, used by Alembic. from airflow.models.base import COLLATION_ARGS +# revision identifiers, used by Alembic. revision = '0a2a5b66e19d' down_revision = '9635ae0956e7' branch_labels = None diff --git a/airflow/migrations/versions/1b38cef5b76e_add_dagrun.py b/airflow/migrations/versions/1b38cef5b76e_add_dagrun.py index 6ef4d91df0ce3..095b496bddcab 100644 --- a/airflow/migrations/versions/1b38cef5b76e_add_dagrun.py +++ b/airflow/migrations/versions/1b38cef5b76e_add_dagrun.py @@ -27,6 +27,8 @@ import sqlalchemy as sa from alembic import op +from airflow.models.base import COLLATION_ARGS + # revision identifiers, used by Alembic. revision = '1b38cef5b76e' down_revision = '502898887f84' @@ -38,10 +40,10 @@ def upgrade(): op.create_table( 'dag_run', sa.Column('id', sa.Integer(), nullable=False), - sa.Column('dag_id', sa.String(length=250), nullable=True), + sa.Column('dag_id', sa.String(length=250, **COLLATION_ARGS), nullable=True), sa.Column('execution_date', sa.DateTime(), nullable=True), sa.Column('state', sa.String(length=50), nullable=True), - sa.Column('run_id', sa.String(length=250), nullable=True), + sa.Column('run_id', sa.String(length=250, **COLLATION_ARGS), nullable=True), sa.Column('external_trigger', sa.Boolean(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('dag_id', 'execution_date'), diff --git a/airflow/migrations/versions/64de9cddf6c9_add_task_fails_journal_table.py b/airflow/migrations/versions/64de9cddf6c9_add_task_fails_journal_table.py index 9d93736eb2190..4243e3a3b40fd 100644 --- a/airflow/migrations/versions/64de9cddf6c9_add_task_fails_journal_table.py +++ b/airflow/migrations/versions/64de9cddf6c9_add_task_fails_journal_table.py @@ -26,9 +26,9 @@ import sqlalchemy as sa from alembic import op -# revision identifiers, used by Alembic. from airflow.models.base import COLLATION_ARGS +# revision identifiers, used by Alembic. revision = '64de9cddf6c9' down_revision = '211e584da130' branch_labels = None diff --git a/airflow/migrations/versions/7939bcff74ba_add_dagtags_table.py b/airflow/migrations/versions/7939bcff74ba_add_dagtags_table.py index 8b8b93c49f750..b207b717f03ab 100644 --- a/airflow/migrations/versions/7939bcff74ba_add_dagtags_table.py +++ b/airflow/migrations/versions/7939bcff74ba_add_dagtags_table.py @@ -27,6 +27,8 @@ import sqlalchemy as sa from alembic import op +from airflow.models.base import COLLATION_ARGS + # revision identifiers, used by Alembic. revision = '7939bcff74ba' down_revision = 'fe461863935f' @@ -39,7 +41,7 @@ def upgrade(): op.create_table( 'dag_tag', sa.Column('name', sa.String(length=100), nullable=False), - sa.Column('dag_id', sa.String(length=250), nullable=False), + sa.Column('dag_id', sa.String(length=250, **COLLATION_ARGS), nullable=False), sa.ForeignKeyConstraint( ['dag_id'], ['dag.dag_id'], diff --git a/airflow/migrations/versions/852ae6c715af_add_rendered_task_instance_fields_table.py b/airflow/migrations/versions/852ae6c715af_add_rendered_task_instance_fields_table.py index 59cbf1a90b672..83a0635dca06b 100644 --- a/airflow/migrations/versions/852ae6c715af_add_rendered_task_instance_fields_table.py +++ b/airflow/migrations/versions/852ae6c715af_add_rendered_task_instance_fields_table.py @@ -27,6 +27,8 @@ import sqlalchemy as sa from alembic import op +from airflow.models.base import COLLATION_ARGS + # revision identifiers, used by Alembic. revision = '852ae6c715af' down_revision = 'a4c2fd67d16b' @@ -51,8 +53,8 @@ def upgrade(): op.create_table( TABLE_NAME, - sa.Column('dag_id', sa.String(length=250), nullable=False), - sa.Column('task_id', sa.String(length=250), nullable=False), + sa.Column('dag_id', sa.String(length=250, **COLLATION_ARGS), nullable=False), + sa.Column('task_id', sa.String(length=250, **COLLATION_ARGS), nullable=False), sa.Column('execution_date', sa.TIMESTAMP(timezone=True), nullable=False), sa.Column('rendered_fields', json_type(), nullable=False), sa.PrimaryKeyConstraint('dag_id', 'task_id', 'execution_date'), diff --git a/airflow/migrations/versions/8646922c8a04_change_default_pool_slots_to_1.py b/airflow/migrations/versions/8646922c8a04_change_default_pool_slots_to_1.py index c60049fc7e55c..678df91ec7636 100644 --- a/airflow/migrations/versions/8646922c8a04_change_default_pool_slots_to_1.py +++ b/airflow/migrations/versions/8646922c8a04_change_default_pool_slots_to_1.py @@ -28,13 +28,12 @@ import sqlalchemy as sa from alembic import op from sqlalchemy import Column, Float, Integer, PickleType, String - -# revision identifiers, used by Alembic. from sqlalchemy.ext.declarative import declarative_base from airflow.models.base import COLLATION_ARGS from airflow.utils.sqlalchemy import UtcDateTime +# revision identifiers, used by Alembic. revision = '8646922c8a04' down_revision = '449b4072c2da' branch_labels = None diff --git a/airflow/migrations/versions/8d48763f6d53_add_unique_constraint_to_conn_id.py b/airflow/migrations/versions/8d48763f6d53_add_unique_constraint_to_conn_id.py index 44be9880ec5ee..b06c8687c5285 100644 --- a/airflow/migrations/versions/8d48763f6d53_add_unique_constraint_to_conn_id.py +++ b/airflow/migrations/versions/8d48763f6d53_add_unique_constraint_to_conn_id.py @@ -27,6 +27,8 @@ import sqlalchemy as sa from alembic import op +from airflow.models.base import COLLATION_ARGS + # revision identifiers, used by Alembic. revision = '8d48763f6d53' down_revision = '8f966b9c467a' @@ -38,7 +40,7 @@ def upgrade(): """Apply add unique constraint to conn_id and set it as non-nullable""" try: with op.batch_alter_table('connection') as batch_op: - batch_op.alter_column("conn_id", nullable=False, existing_type=sa.String(250)) + batch_op.alter_column("conn_id", nullable=False, existing_type=sa.String(250, **COLLATION_ARGS)) batch_op.create_unique_constraint(constraint_name="unique_conn_id", columns=["conn_id"]) except sa.exc.IntegrityError: diff --git a/airflow/migrations/versions/952da73b5eff_add_dag_code_table.py b/airflow/migrations/versions/952da73b5eff_add_dag_code_table.py index a580fc9b1b95b..cfd5d079c9017 100644 --- a/airflow/migrations/versions/952da73b5eff_add_dag_code_table.py +++ b/airflow/migrations/versions/952da73b5eff_add_dag_code_table.py @@ -27,9 +27,9 @@ import sqlalchemy as sa from alembic import op -# revision identifiers, used by Alembic. from airflow.models.dagcode import DagCode +# revision identifiers, used by Alembic. revision = '952da73b5eff' down_revision = '852ae6c715af' branch_labels = None diff --git a/airflow/migrations/versions/b25a55525161_increase_length_of_pool_name.py b/airflow/migrations/versions/b25a55525161_increase_length_of_pool_name.py index 8d343bc90af68..1989af7c2dede 100644 --- a/airflow/migrations/versions/b25a55525161_increase_length_of_pool_name.py +++ b/airflow/migrations/versions/b25a55525161_increase_length_of_pool_name.py @@ -27,6 +27,8 @@ import sqlalchemy as sa from alembic import op +from airflow.models.base import COLLATION_ARGS + # revision identifiers, used by Alembic. revision = 'b25a55525161' down_revision = 'bbf4a7ad0465' @@ -38,7 +40,7 @@ def upgrade(): """Increase column length of pool name from 50 to 256 characters""" # use batch_alter_table to support SQLite workaround with op.batch_alter_table('slot_pool', table_args=sa.UniqueConstraint('pool')) as batch_op: - batch_op.alter_column('pool', type_=sa.String(256)) + batch_op.alter_column('pool', type_=sa.String(256, **COLLATION_ARGS)) def downgrade(): diff --git a/airflow/migrations/versions/cc1e65623dc7_add_max_tries_column_to_task_instance.py b/airflow/migrations/versions/cc1e65623dc7_add_max_tries_column_to_task_instance.py index 9e3bf7b7176e7..bb62ae84dca7e 100644 --- a/airflow/migrations/versions/cc1e65623dc7_add_max_tries_column_to_task_instance.py +++ b/airflow/migrations/versions/cc1e65623dc7_add_max_tries_column_to_task_instance.py @@ -31,10 +31,9 @@ from airflow import settings from airflow.models import DagBag - -# revision identifiers, used by Alembic. from airflow.models.base import COLLATION_ARGS +# revision identifiers, used by Alembic. revision = 'cc1e65623dc7' down_revision = '127d2bf2dfa7' branch_labels = None diff --git a/airflow/migrations/versions/d38e04c12aa2_add_serialized_dag_table.py b/airflow/migrations/versions/d38e04c12aa2_add_serialized_dag_table.py index d8022b4487787..4b8b058dc05fd 100644 --- a/airflow/migrations/versions/d38e04c12aa2_add_serialized_dag_table.py +++ b/airflow/migrations/versions/d38e04c12aa2_add_serialized_dag_table.py @@ -27,6 +27,8 @@ from alembic import op from sqlalchemy.dialects import mysql +from airflow.models.base import COLLATION_ARGS + # revision identifiers, used by Alembic. revision = 'd38e04c12aa2' down_revision = '6e96a59344a4' @@ -49,7 +51,7 @@ def upgrade(): op.create_table( 'serialized_dag', - sa.Column('dag_id', sa.String(length=250), nullable=False), + sa.Column('dag_id', sa.String(length=250, **COLLATION_ARGS), nullable=False), sa.Column('fileloc', sa.String(length=2000), nullable=False), sa.Column('fileloc_hash', sa.Integer(), nullable=False), sa.Column('data', json_type(), nullable=False), diff --git a/airflow/migrations/versions/e38be357a868_update_schema_for_smart_sensor.py b/airflow/migrations/versions/e38be357a868_update_schema_for_smart_sensor.py index 851b97fba8dcb..def5fdf0ba26f 100644 --- a/airflow/migrations/versions/e38be357a868_update_schema_for_smart_sensor.py +++ b/airflow/migrations/versions/e38be357a868_update_schema_for_smart_sensor.py @@ -29,6 +29,8 @@ from sqlalchemy.dialects import mysql from sqlalchemy.engine.reflection import Inspector +from airflow.models.base import COLLATION_ARGS + # revision identifiers, used by Alembic. revision = 'e38be357a868' down_revision = '8d48763f6d53' @@ -66,8 +68,8 @@ def upgrade(): op.create_table( 'sensor_instance', 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), + sa.Column('task_id', sa.String(length=250, **COLLATION_ARGS), nullable=False), + sa.Column('dag_id', sa.String(length=250, **COLLATION_ARGS), nullable=False), sa.Column('execution_date', timestamp(), nullable=False), sa.Column('state', sa.String(length=20), nullable=True), sa.Column('try_number', sa.Integer(), nullable=True), diff --git a/airflow/migrations/versions/e3a246e0dc1_current_schema.py b/airflow/migrations/versions/e3a246e0dc1_current_schema.py index bd0a8a3b55a14..9760232910739 100644 --- a/airflow/migrations/versions/e3a246e0dc1_current_schema.py +++ b/airflow/migrations/versions/e3a246e0dc1_current_schema.py @@ -29,9 +29,9 @@ from sqlalchemy import func from sqlalchemy.engine.reflection import Inspector -# revision identifiers, used by Alembic. from airflow.models.base import COLLATION_ARGS +# revision identifiers, used by Alembic. revision = 'e3a246e0dc1' down_revision = None branch_labels = None @@ -47,7 +47,7 @@ def upgrade(): op.create_table( 'connection', sa.Column('id', sa.Integer(), nullable=False), - sa.Column('conn_id', sa.String(length=250), nullable=True), + sa.Column('conn_id', sa.String(length=250, **COLLATION_ARGS), nullable=True), sa.Column('conn_type', sa.String(length=500), nullable=True), sa.Column('host', sa.String(length=500), nullable=True), sa.Column('schema', sa.String(length=500), nullable=True), @@ -60,7 +60,7 @@ def upgrade(): if 'dag' not in tables: op.create_table( 'dag', - sa.Column('dag_id', sa.String(length=250), nullable=False), + sa.Column('dag_id', sa.String(length=250, **COLLATION_ARGS), nullable=False), sa.Column('is_paused', sa.Boolean(), nullable=True), sa.Column('is_subdag', sa.Boolean(), nullable=True), sa.Column('is_active', sa.Boolean(), nullable=True), @@ -134,7 +134,7 @@ def upgrade(): op.create_table( 'slot_pool', sa.Column('id', sa.Integer(), nullable=False), - sa.Column('pool', sa.String(length=50), nullable=True), + sa.Column('pool', sa.String(length=50, **COLLATION_ARGS), nullable=True), sa.Column('slots', sa.Integer(), nullable=True), sa.Column('description', sa.Text(), nullable=True), sa.PrimaryKeyConstraint('id'), @@ -169,7 +169,7 @@ def upgrade(): op.create_table( 'user', sa.Column('id', sa.Integer(), nullable=False), - sa.Column('username', sa.String(length=250), nullable=True), + sa.Column('username', sa.String(length=250, **COLLATION_ARGS), nullable=True), sa.Column('email', sa.String(length=500), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('username'), @@ -178,7 +178,7 @@ def upgrade(): op.create_table( 'variable', sa.Column('id', sa.Integer(), nullable=False), - sa.Column('key', sa.String(length=250), nullable=True), + sa.Column('key', sa.String(length=250, **COLLATION_ARGS), nullable=True), sa.Column('val', sa.Text(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('key'), diff --git a/airflow/migrations/versions/f2ca10b85618_add_dag_stats_table.py b/airflow/migrations/versions/f2ca10b85618_add_dag_stats_table.py index bfc191aba827c..ce6f5010dd498 100644 --- a/airflow/migrations/versions/f2ca10b85618_add_dag_stats_table.py +++ b/airflow/migrations/versions/f2ca10b85618_add_dag_stats_table.py @@ -26,6 +26,8 @@ import sqlalchemy as sa from alembic import op +from airflow.models.base import COLLATION_ARGS + # revision identifiers, used by Alembic. revision = 'f2ca10b85618' down_revision = '64de9cddf6c9' @@ -36,7 +38,7 @@ def upgrade(): op.create_table( 'dag_stats', - sa.Column('dag_id', sa.String(length=250), nullable=False), + sa.Column('dag_id', sa.String(length=250, **COLLATION_ARGS), nullable=False), sa.Column('state', sa.String(length=50), nullable=False), sa.Column('count', sa.Integer(), nullable=False, default=0), sa.Column('dirty', sa.Boolean(), nullable=False, default=False),