• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rogerpadilla / nukak / #516

29 Dec 2025 12:33PM UTC coverage: 86.536%. Remained the same
#516

push

web-flow
Merge 5d394133c into 97dc5264a

669 of 915 branches covered (73.11%)

Branch coverage included in aggregate %.

135 of 276 new or added lines in 9 files covered. (48.91%)

28 existing lines in 2 files now uncovered.

2294 of 2509 relevant lines covered (91.43%)

146.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

37.5
/packages/migrate/src/generator/sqliteSchemaGenerator.ts
1
import type { ColumnType, FieldOptions } from 'nukak/type';
2
import { AbstractSchemaGenerator } from '../schemaGenerator.js';
1✔
3

4
/**
5
 * SQLite-specific schema generator
6
 */
7
export class SqliteSchemaGenerator extends AbstractSchemaGenerator {
1✔
8
  protected readonly serialPrimaryKeyType = 'INTEGER PRIMARY KEY AUTOINCREMENT';
1✔
9

10
  protected mapColumnType(columnType: ColumnType, field: FieldOptions): string {
11
    // SQLite has dynamic typing, but we use type affinity
12
    switch (columnType) {
5!
13
      case 'int':
14
      case 'smallint':
15
      case 'bigint':
16
      case 'serial':
17
      case 'bigserial':
18
        return 'INTEGER';
2✔
19
      case 'float':
20
      case 'double':
21
      case 'real':
22
      case 'decimal':
23
      case 'numeric':
NEW
24
        return 'REAL';
×
25
      case 'boolean':
NEW
26
        return 'INTEGER'; // SQLite uses 0/1 for booleans
×
27
      case 'char':
28
      case 'varchar':
29
      case 'text':
30
      case 'uuid':
31
        return 'TEXT';
2✔
32
      case 'date':
33
      case 'time':
34
      case 'timestamp':
35
      case 'timestamptz':
NEW
36
        return 'TEXT'; // SQLite stores dates as TEXT or INTEGER
×
37
      case 'json':
38
      case 'jsonb':
39
        return 'TEXT'; // SQLite stores JSON as TEXT
1✔
40
      case 'blob':
41
      case 'bytea':
NEW
42
        return 'BLOB';
×
43
      case 'vector':
NEW
44
        return 'TEXT'; // Store as JSON array
×
45
      default:
NEW
46
        return 'TEXT';
×
47
    }
48
  }
49

50
  protected getBooleanType(): string {
51
    return 'INTEGER';
1✔
52
  }
53

54
  protected generateAlterColumnStatement(tableName: string, columnName: string, newDefinition: string): string {
55
    // SQLite has very limited ALTER TABLE support
56
    // Column type changes require recreating the table
57
    // This is a simplified version that may not work for all cases
NEW
58
    throw new Error(
×
59
      'SQLite does not support altering column definitions. ' +
60
        'You need to recreate the table to change column types.',
61
    );
62
  }
63

64
  override generateDropIndex(tableName: string, indexName: string): string {
NEW
65
    return `DROP INDEX IF EXISTS ${this.escapeId(indexName)};`;
×
66
  }
67

68
  protected override formatDefaultValue(value: unknown): string {
NEW
69
    if (typeof value === 'boolean') {
×
NEW
70
      return value ? '1' : '0';
×
71
    }
NEW
72
    return super.formatDefaultValue(value);
×
73
  }
74
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc