<commit_before># Sails MySQL Transactional ORM

`sails-mysql-transaction` is a Sails ORM Adapter for MySQL with transaction support.

This adapter essentially __wraps__ around the popular `sails-mysql` adapter and provides additional API to perform 
operations that ties around a database transaction.

## Installation

1. Add `sails-mysql-transactions` to your application’s `package.json`. Do not run install directly if `sails` is not 
already installed in your package.


2. If you already have `sails-mysql` installed, it might interfere with operations of this module. Remove it from your 
`package.json` and uninstall the same.

```terminal
npm remove sails-mysql
```

3. This package installs successfully only when sails is already installed in the package. If the package is already installed, then simply run `npm install sails-mysql-transactions --save`, otherwise run `npm install` and it will take 
care of rest.

### Installation Notes:

This package overwrites the `waterline` module inside Sails with a fork of Waterline maintained by Postman. As such, 
if you ever re-install or update sails, ensure you re-install this adapter right after it. 

Do check SailsJS compatibility list before upgrading your Sails version while already using this adapter.

## Using this adapter

The integration test Sails App located in `tests/integration` directory of this repository has a fully functional
installation.

### Sails `config/local.js`

```
{
	connections: {
		mySQLT: {
			adapter: 'sails-mysql-transactions',
			host: '{{your-db-host}}',
			user: '{{your-db-username}}',
			password: '{{<PASSWORD>}}',
			database: '{{your-db-tablename}}'
		}
	},

	models: {
		connection: 'mySQLT',
		migrate: 'drop'
	}
}
```

### Add `transactionId` to all models

```js
module.exports = {
  schema: true,
  autosubscribe: false,
  attributes: {
    property_one: {
      type: 'string'
    },
    property_two: {
      type: 'boolean',
      defaultsTo: false
    },

    transactionId: {
      type: 'string'
    }
  }
};<commit_msg>Updated README.md with basic preface and API<commit_after># Sails MySQL Transactional ORM

`sails-mysql-transaction` is a Sails ORM Adapter for MySQL with transaction support.

This adapter essentially __wraps__ around the popular `sails-mysql` adapter and provides additional API to perform 
operations that ties around a database transaction.

## Installation

1. Add `sails-mysql-transactions` to your application’s `package.json`. Do not run install directly if `sails` is not 
already installed in your package.


2. If you already have `sails-mysql` installed, it might interfere with operations of this module. Remove it from your 
`package.json` and uninstall the same using `npm remove sails-mysql`.

3. This package installs successfully only when sails is already installed in the package. If the package is already installed, then simply run `npm install sails-mysql-transactions --save`, otherwise run `npm install` and it will take 
care of rest.

### Installation Notes:

This package overwrites the `waterline` module inside Sails with a fork of Waterline maintained by Postman. As such, 
if you ever re-install or update sails, ensure you re-install this adapter right after it. 

Do check SailsJS compatibility list before upgrading your Sails version while already using this adapter.

## Using this adapter

The integration test Sails App located in `tests/integration` directory of this repository has a fully functional
installation.

### Sails config/local.js

```js
module.exports = {
  /* your other config stay as is */
  
  connections: {
		mySQLT: {
			adapter: 'sails-mysql-transactions',
			host: '{{your-db-host}}',
			user: '{{your-db-username}}',
			password: '{{<PASSWORD>}}',
			database: '{{your-db-tablename}}'
		}
	},

	models: {
		connection: 'mySQLT',
		migrate: 'drop'
	}
}
```

### Add transactionId column to all models

```js
module.exports = {
  schema: true,
  autosubscribe: false,
  attributes: {
    property_one: {
      type: 'string'
    },
    property_two: {
      type: 'boolean',
      defaultsTo: false
    },

    transactionId: {
      type: 'string'
    }
  }
};
{'fraction_non_alphanumeric': 0.09401298389035825, 'fraction_numerical': 0.001442654484251022, 'mean_word_length': 3.871194379391101, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2903489', 'n_tokens_mistral': 1258, 'n_tokens_neox': 1183, 'n_words': 491}