Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

slite-change

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slite-change

A simple change management system for SQLite3 written in pure JavaScript/TypeScript.

  • 1.0.23
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
70
increased by1300%
Maintainers
1
Weekly downloads
 
Created
Source

slite-change

A simple change management system for SQLite3 written in pure JavaScript/TypeScript.

Getting started

Installing

This needs work. Expecting it to be something like

npm install slite-change

This library reads a sequence of SQL files and applies those as changes to an SQLite3 database.

Only new changes are applied. A change log table maintains the tracking of what changes are already applied.

Change files are simple SQL, because XML sucks!

Formating Of Change Sets

Each change must begin with a comment line starting with --changeset <Author Name>:<change ID>

Each change set file is read in order of directory listing. Change ID values are integers. They must never repeat. They are applied in order as they are found with the changeset file.

This is an example of a simple change set.

--changeset Royce:1
CREATE TABLE 'users' (
  'id' int NOT NULL,
  'firstname' VARCHAR(50),
  'lastname' VARCHAR(50),
  'username' VARCHAR(50),
  'passwd' VARCHAR(50),
  'emailAddress' VARCHAR(50),
  PRIMARY KEY ('id'));

INSERT INTO 'users' (id, firstname, lastname, username, passwd, emailAddress) VALUES (0, 'admin', 'admin', 'admin', 'password', 'roo@localhost');


CREATE TABLE 'config' (
  'parameter' VARCHAR(45) NULL,
  'value' VARCHAR(45) NULL,
  PRIMARY KEY ('parameter'));
  
INSERT INTO 'config' ('parameter','value') VALUES ('db_version', '1');

Once a change set has been appled to a database, no more changes should be made to that change ID, additional changes should be added to a new changeset file with the next value of change ID.

Example changes can be found in db-changes

Usage

Put SQL files into a resources directory and create an instance of slite-change with the arguments of the DB instance and change directory.

    this.Sql = new sqlite.Database('my_database.db', (err) => {
            if (err) {
                    console.log('Could not connect to database', err)
            } else {
                    console.log('Connected to database');

                    let ChangeManager = new SqliteChangeManagement(this.Sql, './src/resources/db-changes/');
            }
    });

Support

Send emails to osgnuru@gmail.com

Contributing

Anyone is welcome to fork this project on GitLab slite-change

Submit a pull request and I will review it.

Authors and acknowledgment

SQLite3 team!!! 🍺🍺🍺

License

GPL-2.0-only

Project status

This is a new project and the authors first time posting to NPM. If something is not working please send an email to the contact above.

Developing This Project

One time only install and setup.

npm install --global np
npm i -g typescript -D
npm i -g typings -D
tsc --init

tsc is configured to compile in package.json in scripts.

To compile

npm run build

Commit to GitLab.com

git commit
git push

Publishing is done by np

np

Keywords

FAQs

Package last updated on 03 Dec 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc