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

umzug

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

umzug - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

41

lib/storages/sequelize.js

@@ -40,5 +40,5 @@ 'use strict';

this.options.storageOptions = _.extend({
//note 'sequelize' or 'model' is required
// note 'sequelize' or 'model' is required
modelName: 'SequelizeMeta',
//note 'tableName' (optional) also supported
// note 'tableName' (optional) also supported
columnName: 'name'

@@ -51,3 +51,3 @@ }, this.options.storageOptions || {});

//initialize model
// initialize model
if (!this.options.storageOptions.model) {

@@ -84,9 +84,8 @@ var sequelize = this.options.storageOptions.sequelize;

logMigration: function (migrationName) {
var self = this;
return this.options.storageOptions.model.sync()
return this._model()
.sync()
.bind(this)
.then(function(Model) {
var migration = {};
migration[self.options.storageOptions.columnName] = migrationName;
migration[this.options.storageOptions.columnName] = migrationName;
return Model.create(migration);

@@ -97,10 +96,9 @@ });

unlogMigration: function (migrationName) {
var self = this;
return this.options.storageOptions.model.sync()
return this._model()
.sync()
.bind(this)
.then(function(Model) {
var where = {};
where[self.options.storageOptions.columnName] = migrationName;
return Model.destroy(where);
where[this.options.storageOptions.columnName] = migrationName;
return Model.destroy({ where: where });
});

@@ -110,6 +108,5 @@ },

executed: function () {
var self = this;
return this.options.storageOptions.model.sync()
return this._model()
.sync()
.bind(this)
.then(function(Model) {

@@ -120,6 +117,10 @@ return Model.findAll();

return migrations.map(function(migration) {
return migration[self.options.storageOptions.columnName];
});
return migration[this.options.storageOptions.columnName];
}.bind(this));
});
},
_model: function () {
return this.options.storageOptions.model;
}
});
{
"name": "umzug",
"version": "1.2.0",
"version": "1.2.1",
"description": "Framework agnostic migration tool for Node.JS",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -194,5 +194,3 @@ 'use strict';

var storage = new Storage({
storageOptions: {
sequelize: this.sequelize
}
storageOptions: { sequelize: this.sequelize }
});

@@ -217,5 +215,3 @@

var storage = new Storage({
storageOptions: {
sequelize: this.sequelize
}
storageOptions: { sequelize: this.sequelize }
});

@@ -241,2 +237,15 @@

it('deletes only the passed migration', function () {
var storage = new Storage({ storageOptions: { sequelize: this.sequelize } });
return storage.logMigration('migration1.js')
.then(function () { return storage.logMigration('migration2.js'); })
.then(function () { return storage.unlogMigration('migration2.js'); })
.then(function () { return storage._model().findAll(); })
.then(function (migrations) {
expect(migrations.length).to.be(1);
expect(migrations[0].name).to.equal('migration1.js');
});
});
it('deletes the migration from the database with a custom column name', function () {

@@ -243,0 +252,0 @@ var storage = new Storage({

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