From ab8da98bd746cb8fb0f6f51706887d970446931b Mon Sep 17 00:00:00 2001 From: Danilo Rodrigues Date: Fri, 14 Feb 2025 13:34:40 -0300 Subject: [PATCH] Remove duplicated condition in primary key check Motivation: We had a redundant check (`col.primary_key or col.primary_key`) that caused confusion and had no logical effect. Modifications: Removed the duplicated check, leaving only a single condition for `col.primary_key`. Result: The code is now clearer and avoids unnecessary duplication. --- cassandra/cqlengine/management.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cassandra/cqlengine/management.py b/cassandra/cqlengine/management.py index 6790a117c7..d84762bef6 100644 --- a/cassandra/cqlengine/management.py +++ b/cassandra/cqlengine/management.py @@ -256,7 +256,7 @@ def _sync_table(model, connection=None): continue - if col.primary_key or col.primary_key: + if col.primary_key: msg = format_log_context("Cannot add primary key '{0}' (with db_field '{1}') to existing table {2}", keyspace=ks_name, connection=connection) raise CQLEngineException(msg.format(model_name, db_name, cf_name))