angelxmoreno / angelxmoreno/bun-sqlite-orm

[Feature]: Manual migration file generation and management

Open
#36 0 comments 0 reactions 0 assignees View on GitHub
cli feature medium-priority migrations minor
Dominant language
TypeScript
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

**Problem Statement:**
While auto-migration works for simple cases, production applications need:
- Controlled schema changes with review process
- Data transformation during migrations
- Rollback capabilities
- Migration history tracking

**Proposed Solution:**
Add migration CLI and infrastructure:

```bash
bun orm migration:generate AddUserEmailIndex
bun orm migration:run
bun orm migration:rollback
bun orm migration:status
```

**Generated Migration Example:**
```typescript
import { Migration } from 'bun-sqlite-orm';

export class AddUserEmailIndex1234567890 implements Migration {
async up(db: Database): Promise {
await db.exec('CREATE INDEX idx_users_email ON users(email)');
}

async down(db: Database): Promise {
await db.exec('DROP INDEX idx_users_email');
}
}
```

**Features:**
- CLI for migration management
- Migration file templates
- Up/down migration execution
- Migration history table
- Schema diffing for auto-generation

Contributor guide

Open the contributing guide

Research direction

Start by examining the proposed migration CLI commands and the generated TypeScript Migration example. Define the scope for generation, up/down execution, rollback, status tracking, and schema diffing before implementing. Done means the requested migration-management workflow is supported with migration history and reversible operations.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, sqlite, typescript
Domain
cli, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.