Skip to content

Commit dc4e89c

Browse files
michaeloboyleclaude
andcommitted
chore: Bump version to 0.2.0 and add CHANGELOG
Release v0.2.0 - MERGE Operations Major Features: - Cypher-like MERGE operations (mergeNode, mergeEdge) - ON CREATE / ON MATCH semantics for idempotent upserts - Index management API for efficient merge operations - Comprehensive documentation and examples - 33 new tests, 1.39x performance improvement 🤖 Generated with Claude Code Co-Authored-By: Claude <[email protected]>
1 parent ffc6629 commit dc4e89c

File tree

2 files changed

+128
-1
lines changed

2 files changed

+128
-1
lines changed

CHANGELOG.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.2.0] - 2025-11-02
9+
10+
### Added
11+
12+
#### 🚀 MERGE Operations (Cypher-like Upserts)
13+
14+
- **`mergeNode()`** - Idempotent node creation with ON CREATE / ON MATCH semantics
15+
- Match on single or multiple properties (AND logic)
16+
- `onCreate` properties applied only when creating new nodes
17+
- `onMatch` properties applied only when matching existing nodes
18+
- Returns `{ node, created }` indicating whether node was created or matched
19+
- Automatic conflict detection when multiple nodes match criteria
20+
- Performance warnings in development mode when no index exists
21+
22+
- **`mergeEdge()`** - Idempotent edge creation between nodes
23+
- Ensures only one edge exists between nodes with given type
24+
- ON CREATE / ON MATCH semantics for edge properties
25+
- Property merging (not replacement) on match
26+
- Returns `{ edge, created }` indicating creation or match
27+
28+
- **Index Management API** for efficient merge operations
29+
- `createPropertyIndex(nodeType, property, unique?)` - Create JSON property indexes
30+
- `listIndexes()` - View all custom merge indexes
31+
- `dropIndex(indexName)` - Remove custom indexes
32+
- Unique constraint support for preventing duplicates
33+
34+
- **New Types**
35+
- `MergeOptions<T>` - Options for node merge with onCreate/onMatch
36+
- `EdgeMergeOptions<T>` - Options for edge merge
37+
- `MergeResult<T>` - Result type with node and created flag
38+
- `EdgeMergeResult<T>` - Result type with edge and created flag
39+
- `IndexInfo` - Index metadata type
40+
- `MergeConflictError` - Error when multiple nodes match merge criteria
41+
- `MergePerformanceWarning` - Warning when merging without indexes
42+
43+
#### 📚 Documentation & Examples
44+
45+
- **[MERGE-DESIGN.md](docs/MERGE-DESIGN.md)** - Complete design specification
46+
- API design rationale and implementation strategy
47+
- Index requirements and performance considerations
48+
- Error handling patterns
49+
- Future enhancement roadmap
50+
51+
- **[merge-patterns.ts](examples/merge-patterns.ts)** - 7 comprehensive examples
52+
- Simple job upsert patterns
53+
- ON CREATE / ON MATCH tracking for ETL pipelines
54+
- Company deduplication across job listings
55+
- Relationship merge for unique edges
56+
- Bulk import with idempotent merge operations
57+
- Merge conflict handling and resolution
58+
- Skills graph with automatic deduplication
59+
- Performance benchmark: 1.39x speedup over manual pattern
60+
61+
#### ✅ Testing
62+
63+
- 33 comprehensive unit tests for merge operations
64+
- 100% coverage of merge functionality
65+
- Tests for creation, matching, conflicts, and edge cases
66+
- Index management test suite
67+
68+
### Performance
69+
70+
- **1.39x faster** than manual SELECT-then-INSERT/UPDATE pattern (with indexes)
71+
- Atomic transactions ensure data consistency
72+
- JSON property indexes enable efficient lookups on large datasets
73+
74+
### Use Cases
75+
76+
Perfect for:
77+
- ETL pipelines that run repeatedly (daily job scrapers, data imports)
78+
- Distributed systems requiring retry-safe operations
79+
- Data deduplication (companies, skills, tags)
80+
- Tracking discovery vs. update timestamps
81+
- Preventing duplicate relationships in graph
82+
83+
### Breaking Changes
84+
85+
None - this is a backward-compatible feature addition.
86+
87+
### Migration Guide
88+
89+
Existing code continues to work. To use merge operations:
90+
91+
```typescript
92+
// Before: Manual upsert pattern
93+
const existing = db.nodes('Company').where({ name }).limit(1).exec()[0];
94+
const company = existing
95+
? db.updateNode(existing.id, data)
96+
: db.createNode('Company', { name, ...data });
97+
98+
// After: Using merge (simpler + faster)
99+
const { node: company } = db.mergeNode('Company', { name }, { name, ...data });
100+
```
101+
102+
For best performance, create indexes on match properties:
103+
104+
```typescript
105+
db.createPropertyIndex('Job', 'url', true); // Unique index
106+
db.mergeNode('Job', { url }, { url, title, status });
107+
```
108+
109+
---
110+
111+
## [0.1.0] - 2025-10-27
112+
113+
### Added
114+
115+
- Initial release with core graph database functionality
116+
- CRUD operations for nodes and edges
117+
- Fluent query DSL with method chaining
118+
- Graph traversal with BFS/DFS
119+
- Shortest path algorithms
120+
- Transaction support with savepoints
121+
- Schema validation
122+
- Import/export functionality
123+
- Comprehensive test suite
124+
- Example applications and documentation
125+
126+
[0.2.0]: https://github.com/michaeloboyle/sqlite-graph/compare/v0.1.0...v0.2.0
127+
[0.1.0]: https://github.com/michaeloboyle/sqlite-graph/releases/tag/v0.1.0

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sqlite-graph",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"description": "High-performance graph database built on SQLite with a fluent query DSL",
55
"license": "MIT",
66
"author": "Michael O'Boyle",

0 commit comments

Comments
 (0)