kaxil commented on a change in pull request #22102:
URL: https://github.com/apache/airflow/pull/22102#discussion_r826117302



##########
File path: airflow/cli/commands/db_command.py
##########
@@ -47,8 +49,40 @@ def resetdb(args):
 def upgradedb(args):
     """Upgrades the metadata database"""
     print("DB: " + repr(settings.engine.url))
-    db.upgradedb(version_range=args.range, revision_range=args.revision_range)
-    print("Upgrades done")
+    if args.revision and args.version:
+        raise SystemExit("Cannot supply both `--revision` and `--version`.")
+    if args.from_version and args.from_revision:
+        raise SystemExit("Cannot supply both `--from-revision` and 
`--from-version`")
+    if (args.from_revision or args.from_version) and not args.show_sql_only:
+        raise SystemExit(
+            "Args `--from-revision` and `--from-version` may only be used with 
`--show-sql-only`"
+        )
+    revision = None
+    from_revision = None
+    if args.from_revision:
+        from_revision = args.from_revision
+    elif args.from_version:
+        if parse_version(args.from_version) < parse_version('2.0.0'):
+            raise SystemExit("From version must be greater or equal to than 
2.0.0")

Review comment:
       Makes it also consistent as the one on L69




-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to