不要怂,就是干,撸起袖子干!

Commit a144c583 by Jan Aagaard Meier

Merge pull request #3687 from mdarveau/master

Added option for default global transaction isolation level.
2 parents 83750392 691f74ad
......@@ -131,10 +131,11 @@ $ DIALECT=dialect SEQ_DB=database SEQ_USER=user SEQ_PW=password make test
```
#### 4a. Check the documentation
This step only applies if you have actually changed something in the documentation. To generate documentation for the `sequelize.js` file, run (in the sequelize dir)
This step only applies if you have actually changed something in the documentation. Please read `CONTRIBUTING.DOCS.md` first.
To generate documentation for the `sequelize.js` file, run (in the sequelize dir)
```console
$ node docs/markdox.js --file lib/sequelize.js
$ npm run docs
```
The generated documentation will be placed in `docs/tmp.md`.
......
......@@ -83,8 +83,8 @@ module.exports = (function() {
* @param {Integer} [options.pool.minConnections]
* @param {Integer} [options.pool.maxIdleTime] The maximum time, in milliseconds, that a connection can be idle before being released
* @param {Function} [options.pool.validateConnection] A function that validates a connection. Called with client. The default function checks that client is an object, and that its state is not disconnected
* @param {Boolean} [options.quoteIdentifiers=true] Set to `false` to make table names and attributes case-insensitive on Postgres and skip double quoting of them.
* @param {String} [options.isolationLevel='REPEATABLE_READ'] Set the default transaction isolation level. See `Sequelize.Transaction.ISOLATION_LEVELS` for possible options.
*/
/**
......@@ -146,7 +146,8 @@ module.exports = (function() {
ssl: undefined,
pool: {},
quoteIdentifiers: true,
hooks: {}
hooks: {},
isolationLevel: Transaction.ISOLATION_LEVELS.REPEATABLE_READ
}, options || {});
if (this.options.dialect === 'postgresql') {
......@@ -1118,7 +1119,7 @@ module.exports = (function() {
* @param {Object} [options={}]
* @param {Boolean} [options.autocommit=true]
* @param {String} [options.isolationLevel='REPEATABLE READ'] See `Sequelize.Transaction.ISOLATION_LEVELS` for possible options
* @param {String} [options.isolationLevel='REPEATABLE_READ'] See `Sequelize.Transaction.ISOLATION_LEVELS` for possible options
* @return {Promise}
* @fires error If there is an uncaught error during the transaction
* @fires success When the transaction has ended (either comitted or rolled back)
......
......@@ -13,7 +13,7 @@ var Transaction = module.exports = function(sequelize, options) {
this.savepoints = [];
this.options = Utils._.extend({
autocommit: true,
isolationLevel: Transaction.ISOLATION_LEVELS.REPEATABLE_READ
isolationLevel: sequelize.options.isolationLevel
}, options || {});
this.id = this.options.transaction ? this.options.transaction.id : Utils.generateUUID();
......@@ -28,7 +28,9 @@ var Transaction = module.exports = function(sequelize, options) {
};
/**
* The possible isolations levels to use when starting a transaction
* The possible isolations levels to use when starting a transaction.
* Can be set per-transaction by passing `options.isolationLevel` to `sequelize.transaction`.
* Default to `REPEATABLE_READ` but you can override the default isolation level by passing `options.isolationLevel` in `new Sequelize`.
*
* ```js
* {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!