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

ah-sequelize-plugin

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ah-sequelize-plugin - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

2

config/sequelize.js
exports.default = {
sequelize: function(api){
return {
"database" : "DEVELOPMNET_DB",
"database" : "DEVELOPMENT_DB",
"dialect" : "mysql",

@@ -6,0 +6,0 @@ "port" : 3306,

@@ -5,83 +5,72 @@ var path = require('path');

exports.sequelize = function(api, next){
api.models = {};
module.exports = {
initialize: function(api, next){
api.models = {};
api.sequelize = {
_start: function(api, next){
next();
},
api.sequelize = {
_teardown: function(api, next){
next();
},
migrate: function(opts, next){
if(typeof opts === "function"){
next = opts;
opts = null;
}
opts = opts === null ? { method: 'up' } : opts;
migrate: function(opts, next){
if(typeof opts === "function"){
next = opts;
opts = null;
}
opts = opts === null ? { method: 'up' } : opts;
var migrator = api.sequelize.sequelize.getMigrator({
path: api.projectRoot + '/migrations'
});
var migrator = api.sequelize.sequelize.getMigrator({
path: api.projectRoot + '/migrations'
});
migrator.migrate(opts).success(function() {
next();
});
},
migrator.migrate(opts).success(function() {
next();
});
},
migrateUndo: function(next) {
this.migrate({ method: 'down' }, next);
},
migrateUndo: function(next) {
this.migrate({ method: 'down' }, next);
},
connect: function(next){
api.sequelize.sequelize = new Sequelize(
api.config.sequelize.database,
api.config.sequelize.username,
api.config.sequelize.password,
api.config.sequelize
);
connect: function(next){
var self = this;
var dir = path.normalize(api.projectRoot + '/models');
fs.readdirSync(dir).forEach(function(file){
var nameParts = file.split("/");
var name = nameParts[(nameParts.length - 1)].split(".")[0];
api.models[name] = api.sequelize.sequelize.import(dir + '/' + file);
});
if(api.env === "test"){
var SequelizeFixtures = require('sequelize-fixtures');
SequelizeFixtures.loadFile(api.projectRoot + '/test/fixtures/*.json', api.models, function(){
SequelizeFixtures.loadFile(api.projectRoot + '/test/fixtures/*.yml', api.models, function(){
api.sequelize.test(next);
});
});
}else{
api.sequelize.test(next);
}
},
api.sequelize.sequelize = new Sequelize(
api.config.sequelize.database,
api.config.sequelize.username,
api.config.sequelize.password,
api.config.sequelize
);
var dir = path.normalize(api.projectRoot + '/models');
fs.readdirSync(dir).forEach(function(file){
var nameParts = file.split("/");
var name = nameParts[(nameParts.length - 1)].split(".")[0];
api.models[name] = api.sequelize.sequelize.import(dir + '/' + file);
})
if(api.env === "test"){
var SequelizeFixtures = require('sequelize-fixtures');
SequelizeFixtures.loadFile(api.projectRoot + '/test/fixtures/*.json', api.models, function(){
SequelizeFixtures.loadFile(api.projectRoot + '/test/fixtures/*.yml', api.models, function(){
self.test(next);
});
test: function(next){
api.sequelize.sequelize.query("SELECT NOW()").success(function(){
next();
}).failure(function(err){
api.log(err, 'warning');
console.log(err);
process.exit();
});
}else{
self.test(next);
}
},
},
test: function(next){
// ensure the connection with a test
api.sequelize.sequelize.query("SELECT NOW()").success(function(){
next()
}).failure(function(err){
api.log(err, 'warning');
console.log(err);
process.exit();
});
},
};
},
startPriority: 1001, // the lowest post-core middleware priority
start: function(api, next){
}
api.sequelize.connect(function(){
// api.sequelize.migrate(function(){
next();
// });
});
}
};

@@ -5,3 +5,3 @@ {

"description": "I use sequelize in actionhero as an ORM",
"version": "0.2.0",
"version": "0.3.0",
"homepage": "http://actionherojs.com",

@@ -12,3 +12,3 @@ "repository": {

},
"keywords": [],
"keywords": ["actionhero", "ah", "sequelie", "database", "api", "mysql", "postgres"],
"engines": {

@@ -15,0 +15,0 @@ "node": ">=0.8.0"

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