bun-sqlite-migrations

1.0.2 • Public • Published

bun-sqlite-migrations

Simple function for migration management for bun:sqlite

Getting started

bun add bun-sqlite-migrations

Example

Add your .sql files into ./migrations, e.g.:

  • 0001_init.sql
  • 0002_add_users_table.sql
  • 0003_add_column_gender_to_users_table.sql

Only the sorting matters. The index of the last executed migration will be stored into the database.

import { migrate, getMigrations } from 'bun-sqlite-migrations'

const db = new Database(`data.db`)
migrate(db, getMigrations('./migrations'))

Verify:

sqlite3 data.db "PRAGMA user_version;"
# should return the number of migrations which were executed
3

/bun-sqlite-migrations/

    Package Sidebar

    Install

    npm i bun-sqlite-migrations

    Homepage

    patwoz.dev

    Weekly Downloads

    46

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    10 kB

    Total Files

    9

    Last publish

    Collaborators

    • patlux