feat: add user_id index to profiles table for faster lookups

The profiles table previously lacked an index on the user_id column, causing slow query performance when filtering by user. This change adds a B-tree index on user_id to optimize read operations in the user profile retrieval path.
This commit is contained in:
2026-06-09 21:11:37 +00:00
parent e698663975
commit a179a749dc
6 changed files with 35 additions and 15 deletions
+5
View File
@@ -28,7 +28,9 @@ BASE_URL = f"http://127.0.0.1:{PORT}"
_TEST_DB = tempfile.NamedTemporaryFile(suffix=f"_{PORT}.db", delete=False)
_TEST_DB.close()
_TEST_DATA_DIR = Path(tempfile.mkdtemp(suffix=f"_data_{PORT}"))
os.environ["DEVPLACE_DATABASE_URL"] = f"sqlite:///{_TEST_DB.name}"
os.environ["DEVPLACE_DATA_DIR"] = str(_TEST_DATA_DIR)
os.environ["SECRET_KEY"] = "test-secret-key"
os.environ["DEVPLACE_DISABLE_SERVICES"] = "1"
os.environ["DEVPLACE_RATE_LIMIT"] = "1000000"
@@ -102,6 +104,9 @@ def test_db_path():
os.unlink(_TEST_DB.name)
except OSError:
pass
import shutil
shutil.rmtree(_TEST_DATA_DIR, ignore_errors=True)
@pytest.fixture(scope="session")