1.0.7 • Published 10 months ago

simple-mysql-migrate v1.0.7

Weekly downloads
-
License
ISC
Repository
-
Last release
10 months ago

Simple-Mysql-Migrate

Dead simple database migration for SQL only

The principle is similar to Flyway and all similar tools, except it's VERY basic and runs in a few lines of code for NodeJS. MySQL only.

Javascript:

const DbMigrate = require('simple-mysql-migrate').default;

const migration = new DbMigrate({
    host: "127.0.0.1",
    port: 3306,
    username: "my_user",
    password: "my_password",
    database: "my_database_name"
});

migration.setMigrationPath("/path/to/my/migration/files/");
migration.migrate();

Typescript:

import DbMigrate from 'simple-mysql-migrate';

// These are the default settings if none are used
const migration = new DbMigrate ({
    "host": "127.0.0.1",
    "port": 3306,
    "username": "my_user",
    "password": "my_password",
    "database": "my_database_name"
});

migration.setMigrationPath("/path/to/my/migration/files/");
await migration.migrate();

It is dead simple: it will scan through the .sql files and run them in order.

A schema_version table will be created to keep track of what has already been ran.

The filenames should be called v[any version]__[any string].sql, for example: v1.2.5__new_user_table.sql

1.0.7

10 months ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

2 years ago

1.0.1

3 years ago

1.0.0

3 years ago