Skip to content

Releases: BesLogic/sails-mysql-atomic

Add support to pass commit data

03 Jan 20:19
Compare
Choose a tag to compare
Pre-release

Added support to do a transaction.commit(someData) so the transaction.after.then(someData => ...) gets resolved with the data passed on the commit. It also works when returning a value in the promise chain if we do not commit manually.

Fix model.beforeValidate in transaction

22 Dec 16:14
Compare
Choose a tag to compare
Pre-release

Added test coverage for each lifecycle callback methods to support transaction. The only one not yet supported is .afterValidate. You can do logic in there, but nothing related to the current transaction.

Added support for deferred queries methods

21 Dec 20:28
Compare
Choose a tag to compare

The hook now supports mixing the query methods together using the transaction object:

  • .limit()
  • .populate()
  • .sort()
  • .skip()
  • .where()
SqlHelper.beginTransaction(transaction => {
                return transaction.forModel(Dog)
                    .create([
                        { name: 'fido' },
                        { name: 'skippy', bones: [{size:'small'}, {size:'large'}] },
                        { name: 'peanut' }
                    ])
                    .then(() => transaction.forModel(Dog)
                        .find({})
                        .populate('bones')
                        .sort('name ASC')
                        .where({name:'skippy'}))
                    .then(results => {
                        results.length.should.be.equal(1);
                        results[0].name.should.be.equal('skippy');
                        results[0].bones.length.should.be.equal(2);
                    })
                    .then(() => done())
                    .catch(done);
            });

Fix support for nested and deeply nested operations

21 Dec 13:54
Compare
Choose a tag to compare

Fixed context injection for nested operations so we can pass the database connection when creating nested associations.

See example in my test:

https://github.com/BesLogic/sails-mysql-atomic/blob/master/test/transactions.spec.js#L592

Fix support for missed query methods

20 Dec 22:16
Compare
Choose a tag to compare
Pre-release

Added missing test to support .findOrCreate(...) under transaction

Code Cleanup

20 Dec 15:21
Compare
Choose a tag to compare
Code Cleanup Pre-release
Pre-release

Simplified the logic by passing along the connection instead of an ID to lookup for the connection.

Major rework to scope transaction in promise context

20 Dec 14:41
Compare
Choose a tag to compare

This release fixes the support for many-to-many associations created or deleted within a transaction.

Example:
https://github.com/BesLogic/sails-mysql-atomic/blob/master/test/transactions.spec.js#L296

Repo renaming

19 Dec 14:23
Compare
Choose a tag to compare
Repo renaming Pre-release
Pre-release

One more step. This repo has been renamed from sails-mysql-transactions-helper to sails-mysql-atomic to avoid confusion with sails-mysql-transactions

Breaking changes

  • The adapter has been renamed from sails-mysql-transactional to sails-mysql-atomic
  • The hook usage has been changed to sails.hooks['sails-mysql-atomic'].beginTransaction(...); (which is shorter to type :])
  • The npm repo has been updated as well to match the new name: https://www.npmjs.com/package/sails-mysql-atomic

Published to npm

19 Dec 12:27
Compare
Choose a tag to compare
Published to npm Pre-release
Pre-release

This hook is now available through npm using npm install sails-mysql-transactions-helper

Breaking change:
The name of the package has changed from mysql-transactions-helper to sails-mysql-transactions-helper so the usage in you project has changed to match the hook name:
sails.hooks['sails-mysql-transactions-helper'].beginTransaction(...);

https://github.com/BesLogic/sails-mysql-transactions-helper#how-to-use-it-in-your-project

Fixed adapter identity typo

19 Dec 11:27
Compare
Choose a tag to compare
Pre-release

One more breaking change:

  • The database adapter name has changed from sails-mysql-transactionnal to sails-mysql-transactional