makemigrations
/makemigrations
Create SQLite migrations for MemoryLane storage schema changes. Use when interfaces or persisted fields change in src/main/storage/index.ts, when a new column/index/table/trigger is needed, or when the user asks to add a migration similar to 0001_initial_schema.ts.
- Author
- deusxmachina-dev ↗
- Repository
- memorylane ↗
- Licence
- GPL-3.0
- Last repository change
- 24.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 24.10.2026, without references to retired models or APIs.
GPL-3.0, otwarta.
What it does and when to use it
Create SQLite migrations for MemoryLane storage schema changes. Use when interfaces or persisted fields change in src/main/storage/index.ts, when a new column/index/table/trigger is needed, or when the user asks to add a migration similar to 0001_initial_schema.ts.
Original author description
Create SQLite migrations for MemoryLane storage schema changes. Use when interfaces or persisted fields change in src/main/storage/index.ts, when a new column/index/table/trigger is needed, or when the user asks to add a migration similar to 0001_initial_schema.ts.
How it works
- Purpose
- When to Use
- Rules
- Workflow
- Examples in Repo
SKILL.md preview
---
name: makemigrations
description: Create SQLite migrations for MemoryLane storage schema changes. Use when interfaces or persisted fields change in src/main/storage/index.ts, when a new column/index/table/trigger is needed, or when the user asks to add a migration similar to 0001_initial_schema.ts.
---
# Create Storage Migration
## Purpose
Keep runtime storage schema in sync with `src/main/storage/index.ts` by adding forward-only migrations in `src/main/storage/migrations/`.
## When to Use
Use this skill when any persisted shape changes, especially:
- `StoredActivity` or `ActivitySummary` field changes in `src/main/storage/index.ts`
- SQL statements in `StorageService` change selected/inserted columns
- New filters require indexes
- Legacy table/data needs migration into current tables
## Rules
1. Never edit or reorder existing migration files after they ship.
2. Always add a new migration with a monotonically increasing 4-digit prefix (`0003_*`, `0004_*`, ...).
3. Migration must be idempotent where possible (`IF EXISTS` / `IF NOT EXISTS`).
4. Migration must be safe on partially migrated user data.
5. Register the new migration in `src/main/storage/migrations/index.ts`.
## Workflow
Copy this checklist and execute in order:
```text
Migration Progress
- [ ] 1) Identify schema delta from index.ts changes
- [ ] 2) Create next migration file in src/main/storage/migrations/
- [ ] 3) Implement migration.up(db) with safe SQL
- [ ] 4) Register migration in src/main/storage/migrations/index.ts
- [ ] 5) Add/update storage migration tests
- [ ] 6) Run tests and lint for touched files
```
### 1) Identify schema delta
Map TypeScript/API changes to SQLite changes:
- Added persisted field -> `ALTER TABLE ... ADD COLUMN` (or backfill strategy)
- Removed field -> usually keep column; stop reading/writing it first, remove later with explicit migration plan
- Renamed field -> add new column + backfill + dual-read/write strategy if needed
- New query pattern -> add index
- New text search shape -> update FTS table/trigger strategy
- Vector shape/dimension changes -> explicit data migration strategy
### 2) Create migration file
Name pattern:
- File: `src/main/storage/migrations/000X_descriptive_name.ts`
- Export: `export const migration: Migration`
- `name` must match file stem exactly (example: `0003_add_window_title_index`)
Template:
```typescript
import Database from 'better-sqlite3'
import type { Migration } from '../migrator'
export const migration: Migration = {
name: '000X_descriptive_name',
up(db: Database.Database): void {
// schema/data updates
},
}
```
### 3) Implement safe SQL
Preferred patterns:
- `db.exec(...)` for DDL batches
- `db.prepare(...).run()` for parameterized DML
- Guard checks using `sqlite_master` when needed
- Wrap multi-step data migrations in `db.transaction(() => { ... })()`
For data moves:
- Use `INSERT OR IGNORE` where duplicate IDs may exist
- Backfill defaults for new NOT NULL columns
- Drop legacy objects only after successful copy
### 4) Register migration
Update `src/main/storage/migrations/index.ts`:
- Add import for the new migration
- Append to `migrations` array at the end (preserve order)
### 5) Tests
Update `src/main/storage/storage.test.ts` (or related tests) to cover:
- Fresh DB applies all migrations successfully
- Existing DB at previous schema upgrades correctly
- Backfilled/default values are correct
- Expected indexes/tables/triggers exist after migration
### 6) Validate
Run relevant checks:
```bash
npm test -- src/main/storage/storage.test.ts
npm run lint
```
If tests are broad or expensive, run targeted tests first, then full suite when requested.
## Examples in Repo
- Baseline schema setup: `src/main/storage/migrations/0001_initial_schema.ts`
- Legacy data migration + cleanup: `src/main/storage/migrations/0002_migrate_context_events.ts`
Versions
The database has no other skills named makemigrations.
Database snapshot: 13.11.2026 · package version c90e43fc7c46 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100db-migration
Use when the user needs a PostgreSQL schema or data change through Liquibase or Flyway: new table, add, rename, or drop a column, add an index, change a constraint, backfill or one-time data fix, zero-downtime migration, or a new entity that needs persistence. - 100migration-safety-checker
This skill should be used when the user asks to "create a migration", "run makemigrations", "modify a model field", "rename a column", or mentions "schema change", "alter table", "database migration". Validates migrations are production-safe. - 100add-migration
Add or change a Postgres schema migration. Use when a feature needs a new table, column or index, or when running `npm run migrate`. - 100alembic-migration
Create, review, and apply database schema changes with Alembic. Use whenever a SQLAlchemy model is added or changed, a column/index/constraint needs to change, or a data backfill is required — anything that alters the PostgreSQL schema. - 100add-store-query
Use when adding or modifying a SQL query against the SQLite store — symptoms include "add a method to *Store", "new column on nodes", "expose X via the store", "add an index", "support a new lookup", "write a migration", or any change to `pkg/store/queries.go`, `pkg/store/*.go`… - 90add-db-migration
Use when a ticket requires a database schema change — a new table/column, an index, a constraint, or a backfill. Invoke for "add a migration for X", "alter the schema", or any change to the persisted data model. Schema changes are high-risk; treat them carefully.