@derherrgammler/sqlimporter

0.1.3 • Public • Published

SQLImporter for Nodejs

An npm Modul. Node.js
Import your *.sql files with multiple sql-statements to your MySQL database.

Installation to Node dependency

  1. Make shure that you have sqlimporter installed locally:
npm i @derherrgammler/sqlimporter
  1. Create *.sql file like my example.sql:
    /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *\
                        Database Recreation
    \* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

DROP DATABASE IF EXISTS example;
CREATE DATABASE example;
USE example;

    /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *\
                        Tabblecreation
    \* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

CREATE TABLE testtable (
    `row1` CHAR(9) NOT NULL PRIMARY KEY,
    `row2` VARCHAR(255) NOT NULL,
    `row3` INT(11) NOT NULL
);

You have to undertstand that there can be Comments but ONLY multiline comments work aktually. I try to change this that also single line comments cna be used in the file.
If you want a new Version with deleting also singleline comments please write a issue in GitHub!

  1. Require and usage:
var sqlimport = require("@derherrgammler/sqlimporter");
var connConfig = {
	host	    : 'localhost',
	user	    : 'root',
	password    : 'root'
};

sqlimport.config(connConfig);
    .importFile("/example.sql");

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

Package Sidebar

Install

npm i @derherrgammler/sqlimporter

Weekly Downloads

2

Version

0.1.3

License

MIT

Unpacked Size

6.34 kB

Total Files

6

Last publish

Collaborators

  • derherrgammler