diff --git a/leapp/cli/upgrade/__init__.py b/leapp/cli/upgrade/__init__.py index 201d7491c..739929c2d 100644 --- a/leapp/cli/upgrade/__init__.py +++ b/leapp/cli/upgrade/__init__.py @@ -77,7 +77,7 @@ def fetch_last_upgrade_context(): """ with get_connection(None) as db: cursor = db.execute( - "SELECT context, stamp, configuration FROM execution WHERE kind = 'upgrade' ORDER BY stamp DESC LIMIT 1") + "SELECT context, stamp, configuration FROM execution WHERE kind = 'upgrade' ORDER BY id DESC LIMIT 1") row = cursor.fetchone() if row: return row[0], json.loads(row[2]) @@ -90,7 +90,7 @@ def fetch_all_upgrade_contexts(): """ with get_connection(None) as db: cursor = db.execute( - "SELECT context, stamp, configuration FROM execution WHERE kind = 'upgrade' ORDER BY stamp DESC") + "SELECT context, stamp, configuration FROM execution WHERE kind = 'upgrade' ORDER BY id DESC") row = cursor.fetchall() if row: return row diff --git a/leapp/snactor/context.py b/leapp/snactor/context.py index 5021f985f..d3ab66502 100644 --- a/leapp/snactor/context.py +++ b/leapp/snactor/context.py @@ -14,7 +14,7 @@ def last_snactor_context(connection=None): """ with get_connection(db=connection) as db: cursor = db.execute(''' - SELECT context, stamp FROM execution WHERE kind = 'snactor-run' ORDER BY stamp DESC LIMIT 1 + SELECT context, stamp FROM execution WHERE kind = 'snactor-run' ORDER BY id DESC LIMIT 1 ''') row = cursor.fetchone() if row: diff --git a/leapp/utils/audit/__init__.py b/leapp/utils/audit/__init__.py index 252c81133..1812e7206 100644 --- a/leapp/utils/audit/__init__.py +++ b/leapp/utils/audit/__init__.py @@ -450,7 +450,7 @@ def get_checkpoints(context): data_source ON data_source.id = audit.data_source_id WHERE audit.context = ? AND audit.event = ? - ORDER BY stamp ASC; + ORDER BY audit.id ASC; ''', (context, _AUDIT_CHECKPOINT_EVENT)) cursor.row_factory = _dict_factory return cursor.fetchall()