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 2020/11/14 03:26:39 UTC

[GitHub] [airflow] kaxil opened a new pull request #12362: Reorder Database Migrations

kaxil opened a new pull request #12362:
URL: https://github.com/apache/airflow/pull/12362


   Becase `2c6edca13270` (Resource based permissions) & `849da589634d` (Prefix DAG permissions)
   were run before `92c57b58940d_add_fab_tables.py` and `03afc6b6f902_increase_length_of_fab_ab_view_menu_.py`,
   the FAB tables were already created because those migrations imported `from airflow.www.app import create_app`
   which calls the following lines that creates tables:
   
   https://github.com/dpgaspar/Flask-AppBuilder/blob/0e7f62418be0aea056302769ebac7d9bfa2bdd4e/flask_appbuilder/security/sqla/manager.py#L86-L97
   
   Previously:
   
   ```
   INFO  [alembic.runtime.migration] Running upgrade bef4f3d11e8b -> 98271e7606e2, Add scheduling_decision to DagRun and DAG
   INFO  [alembic.runtime.migration] Running upgrade 98271e7606e2 -> 52d53670a240, fix_mssql_exec_date_rendered_task_instance_fields_for_MSSQL
   INFO  [alembic.runtime.migration] Running upgrade 52d53670a240 -> 849da589634d, Prefix DAG permissions.
   [2020-11-14 02:35:43,055] {manager.py:727} WARNING - No user yet created, use flask fab command to do it.
   [2020-11-14 02:35:46,790] {migration.py:515} INFO - Running upgrade 849da589634d -> 364159666cbd, Add creating_job_id to DagRun table
   [2020-11-14 02:35:46,794] {migration.py:515} INFO - Running upgrade 364159666cbd -> 2c6edca13270, Resource based permissions.
   [2020-11-14 02:35:46,795] {app.py:87} INFO - User session lifetime is set to 43200 minutes.
   [2020-11-14 02:35:46,806] {manager.py:727} WARNING - No user yet created, use flask fab command to do it.
   [2020-11-14 02:35:48,221] {migration.py:515} INFO - Running upgrade 2c6edca13270 -> 45ba3f1493b9, add-k8s-yaml-to-rendered-templates
   [2020-11-14 02:35:48,226] {migration.py:515} INFO - Running upgrade 45ba3f1493b9 -> 92c57b58940d, Create FAB Tables
   [2020-11-14 02:35:48,227] {migration.py:515} INFO - Running upgrade 92c57b58940d -> 03afc6b6f902, Increase length of FAB ab_view_menu.name column
   ```
   
   Now:
   
   ```
   INFO  [alembic.runtime.migration] Running upgrade bef4f3d11e8b -> 98271e7606e2, Add scheduling_decision to DagRun and DAG
   INFO  [alembic.runtime.migration] Running upgrade 98271e7606e2 -> 52d53670a240, fix_mssql_exec_date_rendered_task_instance_fields_for_MSSQL
   INFO  [alembic.runtime.migration] Running upgrade 52d53670a240 -> 364159666cbd, Add creating_job_id to DagRun table
   INFO  [alembic.runtime.migration] Running upgrade 364159666cbd -> 45ba3f1493b9, add-k8s-yaml-to-rendered-templates
   INFO  [alembic.runtime.migration] Running upgrade 45ba3f1493b9 -> 92c57b58940d, Create FAB Tables
   INFO  [alembic.runtime.migration] Running upgrade 92c57b58940d -> 03afc6b6f902, Increase length of FAB ab_view_menu.name column
   INFO  [alembic.runtime.migration] Running upgrade 03afc6b6f902 -> 849da589634d, Prefix DAG permissions.
   [2020-11-14 02:57:18,886] {manager.py:727} WARNING - No user yet created, use flask fab command to do it.
   [2020-11-14 02:57:22,380] {migration.py:515} INFO - Running upgrade 849da589634d -> 2c6edca13270, Resource based permissions.
   ```
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   


----------------------------------------------------------------
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



[GitHub] [airflow] kaxil commented on a change in pull request #12362: Reorder Database Migrations

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #12362:
URL: https://github.com/apache/airflow/pull/12362#discussion_r523371507



##########
File path: airflow/migrations/versions/92c57b58940d_add_fab_tables.py
##########
@@ -94,20 +94,20 @@ def upgrade():
     if "ab_user" not in tables:
         op.create_table(
             'ab_user',
-            sa.Column('id', sa.INTEGER(), nullable=False, primary_key=True),
+            sa.Column('id', sa.Integer(), nullable=False, primary_key=True),
             sa.Column('first_name', sa.String(length=64), nullable=False),
             sa.Column('last_name', sa.String(length=64), nullable=False),
             sa.Column('username', sa.String(length=64), nullable=False),
             sa.Column('password', sa.String(length=256), nullable=True),
-            sa.Column('active', sa.BOOLEAN(), nullable=True),
+            sa.Column('active', sa.Boolean(), nullable=True),
             sa.Column('email', sa.String(length=64), nullable=False),
-            sa.Column('last_login', sa.DATETIME(), nullable=True),
-            sa.Column('login_count', sa.INTEGER(), nullable=True),
-            sa.Column('fail_login_count', sa.INTEGER(), nullable=True),
-            sa.Column('created_on', sa.DATETIME(), nullable=True),
-            sa.Column('changed_on', sa.DATETIME(), nullable=True),
-            sa.Column('created_by_fk', sa.INTEGER(), nullable=True),
-            sa.Column('changed_by_fk', sa.INTEGER(), nullable=True),
+            sa.Column('last_login', sa.DateTime(), nullable=True),

Review comment:
       This change was needed for Postgres




----------------------------------------------------------------
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



[GitHub] [airflow] kaxil merged pull request #12362: Reorder Database Migrations

Posted by GitBox <gi...@apache.org>.
kaxil merged pull request #12362:
URL: https://github.com/apache/airflow/pull/12362


   


----------------------------------------------------------------
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



[GitHub] [airflow] github-actions[bot] commented on pull request #12362: Reorder Database Migrations

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #12362:
URL: https://github.com/apache/airflow/pull/12362#issuecomment-727168474


   The PR needs to run all tests because it modifies core of Airflow! Please rebase it to latest master or ask committer to re-run it!


----------------------------------------------------------------
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