Socket
Socket
Sign inDemoInstall

bun-sqlite-migrations

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bun-sqlite-migrations

Simple function for migration management for [bun:sqlite](https://bun.sh/docs/api/sqlite)


Version published
Weekly downloads
131
increased by89.86%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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

FAQs

Last updated on 11 Aug 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc