Repository navigation
Initialize database schema (Pure JSON, no migrations) - #141
Merged
Merged
Conversation
## Changes ### IndexManager Module - Created `IndexManager` struct for dynamic JSON path index creation - Supports query-driven index optimization - Safe CREATE INDEX operations (no ALTER TABLE risk) - Methods: create_json_path_index, index_exists, list_indexes - Comprehensive test coverage ### Core Schema Seeding - Added `seed_core_schemas()` method to DatabaseService - Seeded 5 core schemas as nodes: - task: status, assignee, due_date, description fields - person: name, email fields - date: date field - project: name, status fields - text: minimal schema (content only) - Uses INSERT OR IGNORE for idempotent initialization - Schema-as-Node pattern with properties JSON ### Testing - Added tests for schema seeding verification - Verified schema properties structure - Confirmed idempotent initialization - All tests passing, cargo check and clippy clean 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
malibio
force-pushed
the
feature/issue-102-initialize-db-schema
branch
from
October 3, 2025 18:52
0df7463 to
2e06f0c
Compare
## Critical Security Fix - **SQL Injection Prevention**: Added input validation to IndexManager methods - validate_identifier() helper prevents malicious inputs - Comprehensive security tests cover all injection vectors - Fixed error semantics (LibsqlError instead of initialization_failed) ## Improvements - **Type-Safe Schemas**: Use json! macro for compile-time validation - **Performance Indexes**: Added before_sibling_id and created_at indexes - **Better Test Coverage**: Validate ALL schema fields, not just first ## Changes Summary ### IndexManager Security (packages/core/src/db/index_manager.rs) - Added validate_identifier() for SQL injection prevention - Updated create_json_path_index() with validation - Updated index_exists() with validation - Updated list_indexes() with validation - Fixed connection error mapping (LibsqlError) - Added 3 security test suites (56 total assertions) ### Schema Improvements (packages/core/src/db/database.rs) - Refactored seed_core_schemas() to use json! macro - Added before_sibling_id index for sibling ordering - Added created_at index for temporal queries - Improved test_schema_properties_structure() to validate all fields ## Test Results - All 66 tests passing ✅ - cargo check clean ✅ - cargo clippy clean ✅ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
malibio
added a commit
that referenced
this pull request
Feb 4, 2026
* Initialize database schema with Pure JSON architecture (addresses #102) ## Changes ### IndexManager Module - Created `IndexManager` struct for dynamic JSON path index creation - Supports query-driven index optimization - Safe CREATE INDEX operations (no ALTER TABLE risk) - Methods: create_json_path_index, index_exists, list_indexes - Comprehensive test coverage ### Core Schema Seeding - Added `seed_core_schemas()` method to DatabaseService - Seeded 5 core schemas as nodes: - task: status, assignee, due_date, description fields - person: name, email fields - date: date field - project: name, status fields - text: minimal schema (content only) - Uses INSERT OR IGNORE for idempotent initialization - Schema-as-Node pattern with properties JSON ### Testing - Added tests for schema seeding verification - Verified schema properties structure - Confirmed idempotent initialization - All tests passing, cargo check and clippy clean 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Address code review feedback: security fixes and improvements ## Critical Security Fix - **SQL Injection Prevention**: Added input validation to IndexManager methods - validate_identifier() helper prevents malicious inputs - Comprehensive security tests cover all injection vectors - Fixed error semantics (LibsqlError instead of initialization_failed) ## Improvements - **Type-Safe Schemas**: Use json! macro for compile-time validation - **Performance Indexes**: Added before_sibling_id and created_at indexes - **Better Test Coverage**: Validate ALL schema fields, not just first ## Changes Summary ### IndexManager Security (packages/core/src/db/index_manager.rs) - Added validate_identifier() for SQL injection prevention - Updated create_json_path_index() with validation - Updated index_exists() with validation - Updated list_indexes() with validation - Fixed connection error mapping (LibsqlError) - Added 3 security test suites (56 total assertions) ### Schema Improvements (packages/core/src/db/database.rs) - Refactored seed_core_schemas() to use json! macro - Added before_sibling_id index for sibling ordering - Added created_at index for temporal queries - Improved test_schema_properties_structure() to validate all fields ## Test Results - All 66 tests passing ✅ - cargo check clean ✅ - cargo clippy clean ✅ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
malibio
added a commit
that referenced
this pull request
Feb 5, 2026
* Initialize database schema with Pure JSON architecture (addresses #102) ## Changes ### IndexManager Module - Created `IndexManager` struct for dynamic JSON path index creation - Supports query-driven index optimization - Safe CREATE INDEX operations (no ALTER TABLE risk) - Methods: create_json_path_index, index_exists, list_indexes - Comprehensive test coverage ### Core Schema Seeding - Added `seed_core_schemas()` method to DatabaseService - Seeded 5 core schemas as nodes: - task: status, assignee, due_date, description fields - person: name, email fields - date: date field - project: name, status fields - text: minimal schema (content only) - Uses INSERT OR IGNORE for idempotent initialization - Schema-as-Node pattern with properties JSON ### Testing - Added tests for schema seeding verification - Verified schema properties structure - Confirmed idempotent initialization - All tests passing, cargo check and clippy clean 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Address code review feedback: security fixes and improvements ## Critical Security Fix - **SQL Injection Prevention**: Added input validation to IndexManager methods - validate_identifier() helper prevents malicious inputs - Comprehensive security tests cover all injection vectors - Fixed error semantics (LibsqlError instead of initialization_failed) ## Improvements - **Type-Safe Schemas**: Use json! macro for compile-time validation - **Performance Indexes**: Added before_sibling_id and created_at indexes - **Better Test Coverage**: Validate ALL schema fields, not just first ## Changes Summary ### IndexManager Security (packages/core/src/db/index_manager.rs) - Added validate_identifier() for SQL injection prevention - Updated create_json_path_index() with validation - Updated index_exists() with validation - Updated list_indexes() with validation - Fixed connection error mapping (LibsqlError) - Added 3 security test suites (56 total assertions) ### Schema Improvements (packages/core/src/db/database.rs) - Refactored seed_core_schemas() to use json! macro - Added before_sibling_id index for sibling ordering - Added created_at index for temporal queries - Improved test_schema_properties_structure() to validate all fields ## Test Results - All 66 tests passing ✅ - cargo check clean ✅ - cargo clippy clean ✅ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
malibio
added a commit
that referenced
this pull request
Feb 26, 2026
* Initialize database schema with Pure JSON architecture (addresses #102) ## Changes ### IndexManager Module - Created `IndexManager` struct for dynamic JSON path index creation - Supports query-driven index optimization - Safe CREATE INDEX operations (no ALTER TABLE risk) - Methods: create_json_path_index, index_exists, list_indexes - Comprehensive test coverage ### Core Schema Seeding - Added `seed_core_schemas()` method to DatabaseService - Seeded 5 core schemas as nodes: - task: status, assignee, due_date, description fields - person: name, email fields - date: date field - project: name, status fields - text: minimal schema (content only) - Uses INSERT OR IGNORE for idempotent initialization - Schema-as-Node pattern with properties JSON ### Testing - Added tests for schema seeding verification - Verified schema properties structure - Confirmed idempotent initialization - All tests passing, cargo check and clippy clean 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Address code review feedback: security fixes and improvements ## Critical Security Fix - **SQL Injection Prevention**: Added input validation to IndexManager methods - validate_identifier() helper prevents malicious inputs - Comprehensive security tests cover all injection vectors - Fixed error semantics (LibsqlError instead of initialization_failed) ## Improvements - **Type-Safe Schemas**: Use json! macro for compile-time validation - **Performance Indexes**: Added before_sibling_id and created_at indexes - **Better Test Coverage**: Validate ALL schema fields, not just first ## Changes Summary ### IndexManager Security (packages/core/src/db/index_manager.rs) - Added validate_identifier() for SQL injection prevention - Updated create_json_path_index() with validation - Updated index_exists() with validation - Updated list_indexes() with validation - Fixed connection error mapping (LibsqlError) - Added 3 security test suites (56 total assertions) ### Schema Improvements (packages/core/src/db/database.rs) - Refactored seed_core_schemas() to use json! macro - Added before_sibling_id index for sibling ordering - Added created_at index for temporal queries - Improved test_schema_properties_structure() to validate all fields ## Test Results - All 66 tests passing ✅ - cargo check clean ✅ - cargo clippy clean ✅ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #102