Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/ndi/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,17 +216,18 @@ def __init__(self, session_path: str | Path, db_name: str = ".ndi", **backend_kw
db_dir.mkdir(parents=True, exist_ok=True)

# Initialize SQLite driver (wraps DID-python's SQLiteDB)
db_path = db_dir / "ndi.db"
db_path = db_dir / "did-sqlite.sqlite"
self._driver = SQLiteDriver(db_path, **backend_kwargs)

# Binary directory for file attachments
self._binary_dir = self.session_path / db_name / "binary"
# Binary/files directory for file attachments
# Named "files" for compatibility with NDI-MATLAB
self._binary_dir = self.session_path / db_name / "files"
self._binary_dir.mkdir(parents=True, exist_ok=True)

@property
def database_path(self) -> Path:
"""Path to the SQLite database file."""
return self.session_path / self._db_name / "ndi.db"
return self.session_path / self._db_name / "did-sqlite.sqlite"

@property
def binary_path(self) -> Path:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_create_database(self, temp_session):
db = Database(temp_session)
assert db.session_path == temp_session
assert (temp_session / ".ndi").exists()
assert (temp_session / ".ndi" / "ndi.db").exists()
assert (temp_session / ".ndi" / "did-sqlite.sqlite").exists()

def test_create_with_custom_db_name(self, temp_session):
"""Test creating database with custom name."""
Expand Down Expand Up @@ -395,7 +395,7 @@ def test_database_path(self, temp_session):
"""Test database_path property points to SQLite file."""
db = Database(temp_session)
assert db.database_path.exists()
assert str(db.database_path).endswith("ndi.db")
assert str(db.database_path).endswith("did-sqlite.sqlite")

def test_binary_path(self, temp_session):
"""Test binary_path property."""
Expand Down
Loading