Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
mysql-script-deploy
Advanced tools
Deploys your schema changes and routines, it versions all your changes and roles back failed routines to previous versions
This useful little package takes the pain out of updating keeping your database up to date, whether in the development environent or production.
$ npm install mysql-script-deploy --save
Call scriptDeploy method at the end of your main script before your app finishes starting. In an ExpressJS app I place the app.listen() inside the callback function so my server won't start untill all the scripts have deployed.
var scriptDeploy = require('mysql-script-deploy');
var options = {
host : 'example_host',
port : 3306,
user : 'username',
password : 'password',
database : 'example_database',
schemaLocation : path.join(__dirname, 'databaseScripts', 'schemaScripts'),
routinesLocation: path.join(__dirname, 'databaseScripts', 'routineScripts'),
disableLocking : false
};
scriptDeploy(options, function(err) {
if (err) throw err;
app.listen(3000);
});
All schema scripts should be placed in the folder specified by the schemaLocation
option.
All routines should be places in the folder specified by the routinesLocation
option.
DELIMETER
syntax in your routines, it is not only unnecessary but will cause the scripts to fail.Example syntax for function script
CREATE FUNCTION SqrRt (x1 decimal, y1 decimal)
RETURNS decimal
DETERMINISTIC
BEGIN
DECLARE dist decimal;
SET dist = SQRT(x1 - y1);
RETURN dist;
END
localhost
)3306
)true
if you do not wish to lock the database from other instances of mysql-script-deploy from making concurrent changes. (default false
)If the database name in the database options does not exist, mysql-script-deploy will attempt to create it. If it fails for any reason, lack of permissions or incorrect connection details, it will halt and no futher scripts will run.
mysql-script-deploy creates 3 tables the first time you run it in an app. These table will live on the database named in the database option. They are used to track the versions of the schema scripts, functions and stored procedures. It is best to avoid modifying or manually adding any data in these tables.
These tables are:
When running, mysql-script-deploy locks itself to prevent other instances of mysql-script-deploy from running at the same time. This lock only lasts for two minutes so please be patient.
During development or if you only ever wish to connect one instance to the database, you can use the disableLocking
flag in options.
FAQs
Deploys your schema changes and routines, it versions all your changes and roles back failed routines to previous versions
We found that mysql-script-deploy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.