@daanvanberkel/sqlite-migrations

1.0.1 • Public • Published

Sqlite migrations

Install

npm install --save @daanvanberkel/sqlite-migrations

Migration files

Store the database migrations in a separate folder and start the name of the migrations with a number. Example structure:

project
└── migrations
    ├── 01-InitialTableCreation.sql
    └── 02-AlterColumnX.sql

All files starting with a . (dot) are ignored. Only files ending with .sql are used.

Usage

const sqlite3 = require('sqlite3');
const sqlite = require('sqlite');
const migrations = require('@daanvanberkel/sqlite-migrations');

(async () => {
    const db = await sqlite.open({
        filename: __dirname + '/storage.db',
        driver: sqlite3.Database
    });

    await migrations(db, "<PATH_TO_MIGRATIONS_FOLDER>");
})();

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @daanvanberkel/sqlite-migrations

      Weekly Downloads

      1

      Version

      1.0.1

      License

      MIT

      Unpacked Size

      2.97 kB

      Total Files

      3

      Last publish

      Collaborators

      • daanvanberkel