Skip to content

Consolidate Database Schema Seeding to Backend Service - #701

Merged
malibio merged 2 commits into
mainfrom
feature/issue-691-consolidate-schema-seeding
Dec 1, 2025
Merged

malibio merged 2 commits into
mainfrom
feature/issue-691-consolidate-schema-seeding

Conversation

@malibio

@malibio malibio commented Dec 1, 2025

Copy link
Copy Markdown
Collaborator

Closes #691

…691)

## Summary
- Create core_schemas.rs with get_core_schemas() returning Vec<SchemaNode>
- Remove TYPES_WITH_SPOKE_TABLES hardcoded constant - derive from schema definitions
- Add create_schema_node_atomic() for atomic schema creation + DDL sync
- Update NodeService.create_node() to handle schema nodes atomically
- Fix SchemaTableManager DDL generation (SCHEMAFULL, TABLE keyword, FLEXIBLE, COLUMNS)
- Remove task spoke table DDL from schema.surql (now generated dynamically)
- Delete init-schemas-via-proxy.ts TypeScript seeding script

## Key Changes

**Core Definitions (packages/core/src/models/core_schemas.rs)**
- get_core_schemas() returns Vec<SchemaNode> for all 7 core schemas
- Uses existing SchemaNode struct (no new types)
- Task schema has 6 fields (status, priority, due_date, started_at, completed_at, assignee)
- Simple schemas (text, date, header, code-block, quote-block, ordered-list) have no fields

**Dynamic Spoke Table Detection (packages/core/src/db/surreal_store.rs)**
- Added types_with_spoke_tables: HashSet<String> field to SurrealStore
- Added has_spoke_table() method to check if a type needs a spoke table
- Added build_spoke_table_cache() to derive spoke table needs from schema definitions
- Schema type always has spoke table (structural)
- Other types have spoke tables if their schema has fields.len() > 0
- Removed TYPES_WITH_SPOKE_TABLES constant entirely

**Atomic Schema Operations (packages/core/src/db/surreal_store.rs)**
- Added create_schema_node_atomic() for atomic schema creation + DDL execution
- Transaction order: DDL FIRST, then CREATE hub + spoke
- Matches update_schema_node_atomic() pattern for consistency

**NodeService Integration (packages/core/src/services/node_service.rs)**
- Updated create_node() to detect schema nodes and use atomic creation
- Generates DDL via SchemaTableManager.generate_ddl_statements()
- Ensures schema definition and spoke table are created together

**SchemaTableManager Fixes (packages/core/src/services/schema_table_manager.rs)**
- Changed to SCHEMAFULL (not SCHEMALESS) for proper field enforcement
- Added TABLE keyword: "ON TABLE task" not "ON task"
- Added FLEXIBLE to field definitions for user extensions
- Changed index syntax: COLUMNS not FIELDS
- Added option<> wrapping for optional fields
- Added DEFAULT values for required fields with defaults
- Added node field (reverse link to hub) for all spoke tables

**Schema DDL Cleanup (packages/core/src/db/schema.surql)**
- Removed task spoke table definitions (lines 42-59)
- Kept schema spoke table (structural, not schema-derived)
- Updated header comments to reflect dynamic generation

**TypeScript Cleanup**
- Deleted packages/desktop-app/scripts/init-schemas-via-proxy.ts (321 lines)
- Removed dev:browser:init from package.json
- Updated dev:browser to skip init step

## Testing
Frontend: 1440 passed (same as baseline)
Rust: 482 passed (16 ignored) - same as baseline

## Architecture Notes

8 core node types, 7 with schema entries:
1. task - has schema + spoke table
2-7. text, date, header, code-block, quote-block, ordered-list - schema only, no spoke tables
8. schema - NO schema entry (meta-type, structural spoke table in schema.surql)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@malibio
malibio force-pushed the feature/issue-691-consolidate-schema-seeding branch from b6fef90 to 082b845 Compare December 1, 2025 01:31
@malibio

malibio commented Dec 1, 2025

Copy link
Copy Markdown
Collaborator Author

Code Review: PR #701 - Consolidate Database Schema Seeding to Backend Service

Review Type: Initial Review


Requirements Check (Issue #691)

Criterion Status Notes
Core schema definitions use existing SchemaNode struct ✅ core_schemas.rs uses SchemaNode with proper field definitions
seed_core_schemas() method creates 7 schema nodes ✅ Iterates over get_core_schemas() which returns 7 schemas
seed_core_schemas() syncs spoke table DDL for schemas with fields ✅ Uses create_schema_node_atomic() with DDL generation
TYPES_WITH_SPOKE_TABLES constant removed ✅ Replaced with dynamic types_with_spoke_tables: HashSet<String>
Spoke table needs derived from schema definitions at runtime ✅ build_spoke_table_cache() queries schema nodes with fields.len() > 0
Task spoke table DDL removed from schema.surql ✅ Task table now generated dynamically
init-schemas-via-proxy.ts deleted ✅ 321-line TypeScript file removed
Database initializes correctly with all core schemas ✅ Tests pass (482 Rust, 1440 Frontend)
All tests pass (bun run test:all) ✅ Verified
Quality checks pass (bun run quality:fix) ✅ Clean branch

All acceptance criteria met.


Code Review Findings

Architecture & Design (Critical Priority) - APPROVED

🟢 Excellent architectural improvement: The consolidation from hardcoded TYPES_WITH_SPOKE_TABLES to dynamic schema-driven detection is a significant enhancement:

  1. Single Source of Truth: Schema definitions now drive spoke table creation (core_schemas.rs:35-245)
  2. Atomic Operations: New create_schema_node_atomic() ensures schema + DDL consistency (surreal_store.rs:1389-1492)
  3. Clean Separation: DDL generation is properly encapsulated in SchemaTableManager
  4. Idempotent Seeding: Bootstrap cache correctly handles the chicken-and-egg problem during initialization

📝 File: /packages/core/src/db/surreal_store.rs:362-370
The new types_with_spoke_tables field is well-documented and replaces the hardcoded constant appropriately.

Functionality & Correctness (Critical Priority) - APPROVED

🟢 Guard clause correctly prevents DDL generation for simple schemas:

// surreal_store.rs:711
let ddl_statements = if !schema.fields.is_empty() {
    table_manager.generate_ddl_statements(&schema_id, &schema.fields)
} else {
    vec![]
};

This ensures code-block, quote-block, and ordered-list schemas (which have hyphens in their IDs) never hit the type name validation that rejects non-alphanumeric characters.

🟢 Transaction ordering is correct (surreal_store.rs:1396-1459):
DDL statements execute BEFORE node creation, ensuring the spoke table exists when schema entries are created.

Security (Non-Negotiable) - APPROVED

🟢 SQL injection prevention maintained:

  • Type name validation in SchemaTableManager::generate_ddl_statements() (line 115)
  • Field name validation allows alphanumeric, underscore, and colon characters (line 173-177)
  • validate_node_type() whitelist still in place for query operations

Maintainability & Readability (High Priority) - APPROVED

🟢 Excellent code organization:

  • core_schemas.rs has comprehensive module documentation (lines 1-25)
  • Test coverage for get_core_schemas() function (lines 247-306)
  • Clear comments explaining the bootstrap cache pattern (lines 684-689)

🟢 Naming improvements:

  • has_spoke_table() method is more intuitive than checking a constant
  • build_spoke_table_cache() clearly describes its purpose

Testing Strategy (High Priority) - APPROVED

🟢 Test coverage maintained:

  • 482 Rust tests pass (16 ignored - pre-existing)
  • 1440 Frontend tests pass
  • New unit tests in core_schemas.rs verify schema structure

🟡 [Nit] Consider adding an integration test that verifies spoke tables are created correctly during database initialization. This would catch any regression in the atomic seeding logic.

Performance (Important) - APPROVED

🟢 Efficient caching strategy:

  • Spoke table cache is built once during initialization
  • has_spoke_table() is O(1) HashSet lookup with #[inline] hint

Dependencies & Documentation (Important) - APPROVED

🟢 Cleanup completed:

  • init-schemas-via-proxy.ts deleted (321 lines removed)
  • dev:browser:init script removed from package.json
  • Comments in schema.surql updated to explain dynamic generation

Pre-Existing Issue (Not Blocking)

ℹ️ Note: There is a pre-existing inconsistency in VALID_NODE_TYPES (surreal_store.rs:96-105) which uses underscores (code_block, quote_block, ordered_list) while actual node types use hyphens. This is NOT introduced by this PR and does not affect the current implementation since:

  1. The hyphenated schemas have no fields
  2. DDL generation is guarded by !fields.is_empty()

Summary

This is an excellent refactoring that:

  1. Eliminates hardcoded constants - Spoke table requirements are now derived from schema definitions
  2. Ensures atomic consistency - Schema nodes and their DDL are created together in transactions
  3. Reduces code duplication - Removes 321 lines of TypeScript seeding code
  4. Improves maintainability - Adding new schemas with fields automatically creates their spoke tables

The implementation follows established patterns (atomic transactions, hub-spoke architecture), maintains test coverage, and properly handles edge cases.


Recommendation

APPROVE ✅

This change is a definitive net positive for code health. All acceptance criteria are met, tests pass, and the architecture is cleaner and more maintainable.

@malibio malibio left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review completed. Recommendation: APPROVE. All acceptance criteria met - this is a definitive net positive for code health.

@malibio

malibio commented Dec 1, 2025

Copy link
Copy Markdown
Collaborator Author

Address Review Summary

The code review was APPROVED with all 10 acceptance criteria met.

Recommendations Analysis

Type Count Action
🔴 Critical 0 N/A
🟡 Important 0 N/A
🟢 Suggestion/Nit 1 Skipped (see below)

Skipped Recommendations

🟡 [Nit] Integration Test for Spoke Table Creation

Reason: Scope creep / Follow-up item

  • Current test coverage is adequate (482 Rust tests, 1440 Frontend tests pass)
  • Unit tests in core_schemas.rs already verify schema structure
  • The atomic seeding logic is tested indirectly through the existing suite
  • If desired, this can be tracked as a separate technical debt item

Final Status

  • ✅ All acceptance criteria met
  • ✅ All tests passing
  • ✅ Quality checks clean
  • ✅ No blocking issues identified
  • 🚀 Ready for merge

Fixes pre-existing inconsistency where VALID_NODE_TYPES used underscores
(code_block, quote_block, ordered_list) while actual node types use
hyphens (code-block, quote-block, ordered-list).

Instead of fixing the typos, removed the redundant hardcoded constant
entirely. Valid node types are now derived from schema definitions at
runtime, matching the approach used for TYPES_WITH_SPOKE_TABLES.

Changes:
- Remove VALID_NODE_TYPES constant and standalone validate_node_type fn
- Rename build_spoke_table_cache -> build_schema_caches (returns both)
- Add valid_node_types field to SurrealStore struct
- Add validate_node_type() method to SurrealStore
- Update constructors and bootstrap code to initialize both caches

Benefits:
- Single source of truth: schema definitions drive validation
- No risk of underscore/hyphen typos
- Automatically supports new schema types without code changes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@malibio
malibio merged commit 15991fe into main Dec 1, 2025
@malibio
malibio deleted the feature/issue-691-consolidate-schema-seeding branch December 1, 2025 02:03
malibio added a commit that referenced this pull request Feb 4, 2026
* Consolidate schema seeding with dynamic spoke table management (Issue #691)

## Summary
- Create core_schemas.rs with get_core_schemas() returning Vec<SchemaNode>
- Remove TYPES_WITH_SPOKE_TABLES hardcoded constant - derive from schema definitions
- Add create_schema_node_atomic() for atomic schema creation + DDL sync
- Update NodeService.create_node() to handle schema nodes atomically
- Fix SchemaTableManager DDL generation (SCHEMAFULL, TABLE keyword, FLEXIBLE, COLUMNS)
- Remove task spoke table DDL from schema.surql (now generated dynamically)
- Delete init-schemas-via-proxy.ts TypeScript seeding script

## Key Changes

**Core Definitions (packages/core/src/models/core_schemas.rs)**
- get_core_schemas() returns Vec<SchemaNode> for all 7 core schemas
- Uses existing SchemaNode struct (no new types)
- Task schema has 6 fields (status, priority, due_date, started_at, completed_at, assignee)
- Simple schemas (text, date, header, code-block, quote-block, ordered-list) have no fields

**Dynamic Spoke Table Detection (packages/core/src/db/surreal_store.rs)**
- Added types_with_spoke_tables: HashSet<String> field to SurrealStore
- Added has_spoke_table() method to check if a type needs a spoke table
- Added build_spoke_table_cache() to derive spoke table needs from schema definitions
- Schema type always has spoke table (structural)
- Other types have spoke tables if their schema has fields.len() > 0
- Removed TYPES_WITH_SPOKE_TABLES constant entirely

**Atomic Schema Operations (packages/core/src/db/surreal_store.rs)**
- Added create_schema_node_atomic() for atomic schema creation + DDL execution
- Transaction order: DDL FIRST, then CREATE hub + spoke
- Matches update_schema_node_atomic() pattern for consistency

**NodeService Integration (packages/core/src/services/node_service.rs)**
- Updated create_node() to detect schema nodes and use atomic creation
- Generates DDL via SchemaTableManager.generate_ddl_statements()
- Ensures schema definition and spoke table are created together

**SchemaTableManager Fixes (packages/core/src/services/schema_table_manager.rs)**
- Changed to SCHEMAFULL (not SCHEMALESS) for proper field enforcement
- Added TABLE keyword: "ON TABLE task" not "ON task"
- Added FLEXIBLE to field definitions for user extensions
- Changed index syntax: COLUMNS not FIELDS
- Added option<> wrapping for optional fields
- Added DEFAULT values for required fields with defaults
- Added node field (reverse link to hub) for all spoke tables

**Schema DDL Cleanup (packages/core/src/db/schema.surql)**
- Removed task spoke table definitions (lines 42-59)
- Kept schema spoke table (structural, not schema-derived)
- Updated header comments to reflect dynamic generation

**TypeScript Cleanup**
- Deleted packages/desktop-app/scripts/init-schemas-via-proxy.ts (321 lines)
- Removed dev:browser:init from package.json
- Updated dev:browser to skip init step

## Testing
Frontend: 1440 passed (same as baseline)
Rust: 482 passed (16 ignored) - same as baseline

## Architecture Notes

8 core node types, 7 with schema entries:
1. task - has schema + spoke table
2-7. text, date, header, code-block, quote-block, ordered-list - schema only, no spoke tables
8. schema - NO schema entry (meta-type, structural spoke table in schema.surql)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Remove hardcoded VALID_NODE_TYPES, derive from schemas (Issue #691)

Fixes pre-existing inconsistency where VALID_NODE_TYPES used underscores
(code_block, quote_block, ordered_list) while actual node types use
hyphens (code-block, quote-block, ordered-list).

Instead of fixing the typos, removed the redundant hardcoded constant
entirely. Valid node types are now derived from schema definitions at
runtime, matching the approach used for TYPES_WITH_SPOKE_TABLES.

Changes:
- Remove VALID_NODE_TYPES constant and standalone validate_node_type fn
- Rename build_spoke_table_cache -> build_schema_caches (returns both)
- Add valid_node_types field to SurrealStore struct
- Add validate_node_type() method to SurrealStore
- Update constructors and bootstrap code to initialize both caches

Benefits:
- Single source of truth: schema definitions drive validation
- No risk of underscore/hyphen typos
- Automatically supports new schema types without code changes

🤖 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
* Consolidate schema seeding with dynamic spoke table management (Issue #691)

## Summary
- Create core_schemas.rs with get_core_schemas() returning Vec<SchemaNode>
- Remove TYPES_WITH_SPOKE_TABLES hardcoded constant - derive from schema definitions
- Add create_schema_node_atomic() for atomic schema creation + DDL sync
- Update NodeService.create_node() to handle schema nodes atomically
- Fix SchemaTableManager DDL generation (SCHEMAFULL, TABLE keyword, FLEXIBLE, COLUMNS)
- Remove task spoke table DDL from schema.surql (now generated dynamically)
- Delete init-schemas-via-proxy.ts TypeScript seeding script

## Key Changes

**Core Definitions (packages/core/src/models/core_schemas.rs)**
- get_core_schemas() returns Vec<SchemaNode> for all 7 core schemas
- Uses existing SchemaNode struct (no new types)
- Task schema has 6 fields (status, priority, due_date, started_at, completed_at, assignee)
- Simple schemas (text, date, header, code-block, quote-block, ordered-list) have no fields

**Dynamic Spoke Table Detection (packages/core/src/db/surreal_store.rs)**
- Added types_with_spoke_tables: HashSet<String> field to SurrealStore
- Added has_spoke_table() method to check if a type needs a spoke table
- Added build_spoke_table_cache() to derive spoke table needs from schema definitions
- Schema type always has spoke table (structural)
- Other types have spoke tables if their schema has fields.len() > 0
- Removed TYPES_WITH_SPOKE_TABLES constant entirely

**Atomic Schema Operations (packages/core/src/db/surreal_store.rs)**
- Added create_schema_node_atomic() for atomic schema creation + DDL execution
- Transaction order: DDL FIRST, then CREATE hub + spoke
- Matches update_schema_node_atomic() pattern for consistency

**NodeService Integration (packages/core/src/services/node_service.rs)**
- Updated create_node() to detect schema nodes and use atomic creation
- Generates DDL via SchemaTableManager.generate_ddl_statements()
- Ensures schema definition and spoke table are created together

**SchemaTableManager Fixes (packages/core/src/services/schema_table_manager.rs)**
- Changed to SCHEMAFULL (not SCHEMALESS) for proper field enforcement
- Added TABLE keyword: "ON TABLE task" not "ON task"
- Added FLEXIBLE to field definitions for user extensions
- Changed index syntax: COLUMNS not FIELDS
- Added option<> wrapping for optional fields
- Added DEFAULT values for required fields with defaults
- Added node field (reverse link to hub) for all spoke tables

**Schema DDL Cleanup (packages/core/src/db/schema.surql)**
- Removed task spoke table definitions (lines 42-59)
- Kept schema spoke table (structural, not schema-derived)
- Updated header comments to reflect dynamic generation

**TypeScript Cleanup**
- Deleted packages/desktop-app/scripts/init-schemas-via-proxy.ts (321 lines)
- Removed dev:browser:init from package.json
- Updated dev:browser to skip init step

## Testing
Frontend: 1440 passed (same as baseline)
Rust: 482 passed (16 ignored) - same as baseline

## Architecture Notes

8 core node types, 7 with schema entries:
1. task - has schema + spoke table
2-7. text, date, header, code-block, quote-block, ordered-list - schema only, no spoke tables
8. schema - NO schema entry (meta-type, structural spoke table in schema.surql)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Remove hardcoded VALID_NODE_TYPES, derive from schemas (Issue #691)

Fixes pre-existing inconsistency where VALID_NODE_TYPES used underscores
(code_block, quote_block, ordered_list) while actual node types use
hyphens (code-block, quote-block, ordered-list).

Instead of fixing the typos, removed the redundant hardcoded constant
entirely. Valid node types are now derived from schema definitions at
runtime, matching the approach used for TYPES_WITH_SPOKE_TABLES.

Changes:
- Remove VALID_NODE_TYPES constant and standalone validate_node_type fn
- Rename build_spoke_table_cache -> build_schema_caches (returns both)
- Add valid_node_types field to SurrealStore struct
- Add validate_node_type() method to SurrealStore
- Update constructors and bootstrap code to initialize both caches

Benefits:
- Single source of truth: schema definitions drive validation
- No risk of underscore/hyphen typos
- Automatically supports new schema types without code changes

🤖 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
* Consolidate schema seeding with dynamic spoke table management (Issue #691)

## Summary
- Create core_schemas.rs with get_core_schemas() returning Vec<SchemaNode>
- Remove TYPES_WITH_SPOKE_TABLES hardcoded constant - derive from schema definitions
- Add create_schema_node_atomic() for atomic schema creation + DDL sync
- Update NodeService.create_node() to handle schema nodes atomically
- Fix SchemaTableManager DDL generation (SCHEMAFULL, TABLE keyword, FLEXIBLE, COLUMNS)
- Remove task spoke table DDL from schema.surql (now generated dynamically)
- Delete init-schemas-via-proxy.ts TypeScript seeding script

## Key Changes

**Core Definitions (packages/core/src/models/core_schemas.rs)**
- get_core_schemas() returns Vec<SchemaNode> for all 7 core schemas
- Uses existing SchemaNode struct (no new types)
- Task schema has 6 fields (status, priority, due_date, started_at, completed_at, assignee)
- Simple schemas (text, date, header, code-block, quote-block, ordered-list) have no fields

**Dynamic Spoke Table Detection (packages/core/src/db/surreal_store.rs)**
- Added types_with_spoke_tables: HashSet<String> field to SurrealStore
- Added has_spoke_table() method to check if a type needs a spoke table
- Added build_spoke_table_cache() to derive spoke table needs from schema definitions
- Schema type always has spoke table (structural)
- Other types have spoke tables if their schema has fields.len() > 0
- Removed TYPES_WITH_SPOKE_TABLES constant entirely

**Atomic Schema Operations (packages/core/src/db/surreal_store.rs)**
- Added create_schema_node_atomic() for atomic schema creation + DDL execution
- Transaction order: DDL FIRST, then CREATE hub + spoke
- Matches update_schema_node_atomic() pattern for consistency

**NodeService Integration (packages/core/src/services/node_service.rs)**
- Updated create_node() to detect schema nodes and use atomic creation
- Generates DDL via SchemaTableManager.generate_ddl_statements()
- Ensures schema definition and spoke table are created together

**SchemaTableManager Fixes (packages/core/src/services/schema_table_manager.rs)**
- Changed to SCHEMAFULL (not SCHEMALESS) for proper field enforcement
- Added TABLE keyword: "ON TABLE task" not "ON task"
- Added FLEXIBLE to field definitions for user extensions
- Changed index syntax: COLUMNS not FIELDS
- Added option<> wrapping for optional fields
- Added DEFAULT values for required fields with defaults
- Added node field (reverse link to hub) for all spoke tables

**Schema DDL Cleanup (packages/core/src/db/schema.surql)**
- Removed task spoke table definitions (lines 42-59)
- Kept schema spoke table (structural, not schema-derived)
- Updated header comments to reflect dynamic generation

**TypeScript Cleanup**
- Deleted packages/desktop-app/scripts/init-schemas-via-proxy.ts (321 lines)
- Removed dev:browser:init from package.json
- Updated dev:browser to skip init step

## Testing
Frontend: 1440 passed (same as baseline)
Rust: 482 passed (16 ignored) - same as baseline

## Architecture Notes

8 core node types, 7 with schema entries:
1. task - has schema + spoke table
2-7. text, date, header, code-block, quote-block, ordered-list - schema only, no spoke tables
8. schema - NO schema entry (meta-type, structural spoke table in schema.surql)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Remove hardcoded VALID_NODE_TYPES, derive from schemas (Issue #691)

Fixes pre-existing inconsistency where VALID_NODE_TYPES used underscores
(code_block, quote_block, ordered_list) while actual node types use
hyphens (code-block, quote-block, ordered-list).

Instead of fixing the typos, removed the redundant hardcoded constant
entirely. Valid node types are now derived from schema definitions at
runtime, matching the approach used for TYPES_WITH_SPOKE_TABLES.

Changes:
- Remove VALID_NODE_TYPES constant and standalone validate_node_type fn
- Rename build_spoke_table_cache -> build_schema_caches (returns both)
- Add valid_node_types field to SurrealStore struct
- Add validate_node_type() method to SurrealStore
- Update constructors and bootstrap code to initialize both caches

Benefits:
- Single source of truth: schema definitions drive validation
- No risk of underscore/hyphen typos
- Automatically supports new schema types without code changes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consolidate Database Schema Seeding to Backend Service

1 participant