diff --git a/arkindex_worker/cache.py b/arkindex_worker/cache.py index dbcb8dd210af40aae3b17064e58f163b1f02cc4a..2a36c219ee85d4678180e2fe1c4c2e452e30828b 100644 --- a/arkindex_worker/cache.py +++ b/arkindex_worker/cache.py @@ -6,7 +6,7 @@ from arkindex_worker import logger SQL_ELEMENTS_TABLE_CREATION = """CREATE TABLE IF NOT EXISTS elements ( id VARCHAR(32) PRIMARY KEY, - parent_id VARCHAR(32) NOT NULL, + parent_id VARCHAR(32), name TEXT NOT NULL, type TEXT NOT NULL, polygon TEXT, @@ -17,8 +17,8 @@ SQL_ELEMENTS_TABLE_CREATION = """CREATE TABLE IF NOT EXISTS elements ( CachedElement = namedtuple( "CachedElement", - ["id", "parent_id", "name", "type", "polygon", "worker_version_id", "initial"], - defaults=[0], + ["id", "name", "type", "polygon", "worker_version_id", "parent_id", "initial"], + defaults=[None, 0], ) diff --git a/tests/data/cache/tables.sqlite b/tests/data/cache/tables.sqlite index ab1d47aeef67ef2c16d6ca3a2aec4b1b2c1cceee..be29e25631f18d386ad8c644ead09e91792a3d43 100644 Binary files a/tests/data/cache/tables.sqlite and b/tests/data/cache/tables.sqlite differ diff --git a/tests/test_cache.py b/tests/test_cache.py index 07754469378861d41d2954f714dc14970d0877a5..fde2c681189a99fdce2476f38533fb91ebcb7285 100644 --- a/tests/test_cache.py +++ b/tests/test_cache.py @@ -60,7 +60,7 @@ def test_create_tables_existing_table(): with open(db_path, "rb") as after_file: after = after_file.read() - assert before == after + assert before == after, "Cache was modified" def test_create_tables(): @@ -113,7 +113,7 @@ def test_insert_existing_lines(): with open(db_path, "rb") as after_file: after = after_file.read() - assert before == after + assert before == after, "Cache was modified" def test_insert():