import os import pytest def test_embeddings_migration_creates_table(tmp_path): try: import duckdb except ImportError: pytest.skip("duckdb is not installed") db_file = str(tmp_path / "migrations_test.db") conn = duckdb.connect(database=db_file) try: sql = open("migrations/2026-03-19-add-embeddings.sql", "r").read() conn.execute(sql) # Use sequence to set id if present, otherwise provide explicit id try: next_id = conn.execute("SELECT nextval('embeddings_id_seq')").fetchone()[0] except Exception: next_id = 1 conn.execute( "INSERT INTO embeddings (id, motion_id, model, vector) VALUES (?, ?, ?, ?)", (next_id, 1, "m1", "[0.1, 0.2]"), ) res = conn.execute( "SELECT motion_id, model FROM embeddings WHERE motion_id = 1" ).fetchall() assert len(res) == 1 assert res[0][1] == "m1" finally: conn.close()