Add three tests requested in review:
- TestParseMigrationVersion: table-driven test with 9 cases covering valid
filenames, descriptions, invalid alpha/mixed, and empty string
- TestApplyMigrations_Idempotent: verifies running migrations twice is a
no-op with no duplicate rows in schema_migrations
- TestBootstrapMigrationsTable_FreshDatabase: isolation test verifying
bootstrap creates schema_migrations table with version 0 row
Replace the monolithic schema.sql embed with a numbered migration system
following the pixa pattern:
- Add schema/000.sql: bootstrap migration creating schema_migrations table
with INTEGER PRIMARY KEY version column and applied_at timestamp
- Move full schema to schema/001.sql (renamed from schema.sql)
- Remove redundant schema/008_uploads.sql (uploads table already in main schema)
- Rewrite database.go migration logic:
- Embed schema/*.sql directory instead of single schema.sql
- bootstrapMigrationsTable() checks for table existence, applies 000.sql
- applyMigrations() iterates numbered files, skips already-applied versions
- ParseMigrationVersion() extracts version from filenames (e.g. 001.sql)
- Go code does zero INSERTs for bootstrap — 000.sql is self-contained
- Update database_test.go to verify schema_migrations table exists
- Add unified compression/encryption package in internal/blobgen
- Update DATAMODEL.md to reflect current schema implementation
- Refactor snapshot cleanup into well-named methods for clarity
- Add snapshot_id to uploads table to track new blobs per snapshot
- Fix blob count reporting for incremental backups
- Add DeleteOrphaned method to BlobChunkRepository
- Fix cleanup order to respect foreign key constraints
- Update tests to reflect schema changes
- Add pure Go SQLite driver (modernc.org/sqlite) to avoid CGO dependency
- Implement database connection management with WAL mode
- Add write mutex for serializing concurrent writes
- Create schema for all tables matching DESIGN.md specifications
- Implement repository pattern for all database entities:
- Files, FileChunks, Chunks, Blobs, BlobChunks, ChunkFiles, Snapshots
- Add transaction support with proper rollback handling
- Add fatal error handling for database integrity issues
- Add snapshot fields for tracking file sizes and compression ratios
- Make index path configurable via VAULTIK_INDEX_PATH environment variable
- Add comprehensive test coverage for all repositories
- Add format check to Makefile to ensure code formatting