Merge branch 'seed-europe'

# Conflicts:
#	README.md
This commit is contained in:
Wolf committed 2026-09-28 15:27:48 +02:00
commit 3aee48997c
19 files changed
+3362 -1394

No files matched your search

+7 -3
View File
@@ -93,6 +93,8 @@ def test_a_v1_file_migrates_to_the_shape_a_new_file_has(tmp_path: Path) -> None:
# v1 had affinity on the company; the vote columns v4 added and v6
# drops again are not in a fresh file, so there is nothing to put back.
conn.execute("ALTER TABLE companies ADD COLUMN affinity INTEGER NOT NULL DEFAULT 0")
for column in ("ats", "country", "city"): # v7
conn.execute(f"ALTER TABLE companies DROP COLUMN {column}")
for table in ("vectors", "role_tags", "agent_companies", "role_votes"):
conn.execute(f"DROP TABLE {table}")
conn.execute("PRAGMA user_version = 1")
@@ -113,6 +115,8 @@ def _downgrade_to_v4(path: Path) -> None:
conn.execute("ALTER TABLE roles ADD COLUMN vote INTEGER CHECK (vote IN (-1, 0, 1))")
conn.execute("ALTER TABLE roles ADD COLUMN voted_at TEXT")
conn.execute("ALTER TABLE companies ADD COLUMN affinity INTEGER NOT NULL DEFAULT 0")
for column in ("ats", "country", "city"): # v7
conn.execute(f"ALTER TABLE companies DROP COLUMN {column}")
conn.execute("DROP TABLE agent_companies")
conn.execute("DROP TABLE role_votes")
conn.execute("PRAGMA user_version = 4")
@@ -139,7 +143,7 @@ def test_v6_moves_the_votes_and_affinities_to_the_default_agent(tmp_path: Path)
migrated = Store(path)
assert migrated.migrations_applied == [5, 6]
assert migrated.migrations_applied == list(range(5, LATEST + 1))
assert [a.name for a in migrated.agents()] == ["First", "Second"] # none added
assert migrated.votes(first.id) == {posting("liked").uid: 1, posting("passed").uid: -1}
assert migrated.votes(second.id) == {}
@@ -181,7 +185,7 @@ def test_v6_makes_no_agent_when_there_is_nothing_to_move(tmp_path: Path) -> None
store.add_company("Acme", key="acme")
_downgrade_to_v4(path)
assert Store(path).migrations_applied == [5, 6]
assert Store(path).migrations_applied == list(range(5, LATEST + 1))
assert Store(path).agents() == []
@@ -191,7 +195,7 @@ def test_a_v4_file_migrates_read_state_and_tags(tmp_path: Path) -> None:
Store(old)
_downgrade_to_v4(old)
assert Store(old).migrations_applied == [5, 6]
assert Store(old).migrations_applied == list(range(5, LATEST + 1))
assert sorted(_columns(old, "roles")) == sorted(_columns(fresh, "roles"))
with sqlite3.connect(old) as conn:
tables = {r[0] for r in conn.execute(