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

Commit b7f5b84e by Jan Aagaard Meier

chore(ci): Update build matrix (#5918)

* chore(ci): Update build matrix

* 🔥 Mariadb

* Remove 0.12 from build matrix

* Update .travis.yml
1 parent 75c3cb87
......@@ -13,3 +13,4 @@ coverage-*
site
docs/api/tmp.md
ssce.js
coverage
language: node_js
node_js:
- "0.10"
- "0.12"
- "iojs-v1"
- "iojs-v2"
sudo: false
node_js:
- "4"
cache:
directories:
- node_modules
env:
- DIALECT=mysql
- DIALECT=postgres
- DIALECT=postgres-native
- DIALECT=sqlite
- DIALECT=mariadb
- DIALECT=mssql
global:
- CC=clang
- CXX=clang++
- npm_config_clang=1
- COVERALLS_REPO_TOKEN=751SiA6QhY5EH4P2ygq7JFWulqiD2ETXO
- COVERALLS_PARALLEL=true
matrix:
- DIALECT=mysql
- DIALECT=postgres
- DIALECT=postgres-native
- DIALECT=sqlite
- DIALECT=mssql
addons:
apt:
sources:
- llvm-toolchain-precise-3.6
- ubuntu-toolchain-r-test
packages:
- clang-3.6
- g++-4.8
addons:
postgresql: "9.4"
......@@ -32,10 +44,17 @@ script:
- "npm test"
matrix:
fast_finish: true
include:
- node_js: "0.10"
env: COVERAGE=true
allow_failures:
- node_js: "0.10"
env: COVERAGE=true
- node_js: "6"
env: COVERAGE=true DIALECT=mysql
- node_js: "6"
env: COVERAGE=true DIALECT=postgres
- node_js: "6"
env: COVERAGE=true DIALECT=postgres-native
- node_js: "6"
env: COVERAGE=true DIALECT=sqlite
- node_js: "6"
env: COVERAGE=true DIALECT=mssql
notifications:
webhooks: https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN
......@@ -131,7 +131,7 @@ All tests are located in the `test` folder (which contains the
lovely [Mocha](http://visionmedia.github.io/mocha/) tests).
```console
$ npm run test-all || test-mysql || test-sqlite || test-mssql || test-postgres || test-mariadb || test-postgres-native
$ npm run test-all || test-mysql || test-sqlite || test-mssql || test-postgres || test-postgres-native
$ # alternatively you can pass database credentials with $variables when testing
$ DIALECT=dialect SEQ_DB=database SEQ_USER=user SEQ_PW=password npm test
......
FROM node:5
FROM node:6
RUN apt-get install libpq-dev
COPY package.json /
ENV NPM_CONFIG_LOGLEVEL error
RUN npm install
WORKDIR /sequelize
......
# Sequelize
[![Build Status](https://travis-ci.org/sequelize/sequelize.svg?branch=master)](https://travis-ci.org/sequelize/sequelize) [![Dependency Status](https://david-dm.org/sequelize/sequelize.svg)](https://david-dm.org/sequelize/sequelize) [![Test Coverage](https://codeclimate.com/github/sequelize/sequelize/badges/coverage.svg)](https://codeclimate.com/github/sequelize/sequelize)
[![Build Status](https://travis-ci.org/sequelize/sequelize.svg?branch=master)](https://travis-ci.org/sequelize/sequelize)
[![Coverage Status](https://coveralls.io/repos/github/sequelize/sequelize/badge.svg?branch=master)](https://coveralls.io/github/sequelize/sequelize?branch=master)
[![Bountysource](https://www.bountysource.com/badge/team?team_id=955&style=bounties_received)](https://www.bountysource.com/teams/sequelize/issues?utm_source=Sequelize&utm_medium=shield&utm_campaign=bounties_received)
[![Slack Status](http://sequelize-slack.herokuapp.com/badge.svg)](http://sequelize-slack.herokuapp.com)
Sequelize is a promise-based Node.js/io.js ORM for Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server. It features solid transaction support, relations, read replication and more.
Sequelize is a promise-based Node.js/io.js ORM for Postgres, MySQL, SQLite and Microsoft SQL Server. It features solid transaction support, relations, read replication and more.
[Documentation](http://sequelize.readthedocs.org/en/latest/)
......
......@@ -11,6 +11,7 @@
- [REMOVED] Support for `pool:false`
- [REMOVED] Default transaction isolation level [#5094](https://github.com/sequelize/sequelize/issues/5094)
- [ADDED] Add logging for mysql warnings, observant of the `showWarnings` option. [#5900](https://github.com/sequelize/sequelize/issues/5900)
- [REMOVED] MariaDB dialect
## BC breaks:
- `hookValidate` removed in favor of `validate` with `hooks: true | false`. `validate` returns a promise which is rejected if validation fails
......@@ -21,6 +22,7 @@
- (MySQL) `BIGINT` now gets converted to string when number is too big
- Removed support for `pool:false`, if you still want to use single connection set `pool.max` to `1`
- Removed default `REPEATABLE_READ` transaction isolation, use config option to explicitly set it
- Removed MariaDB dialect - this was just a thin wrapper around MySQL, so using `dialect: 'mysql'` instead should work with no further changes
# 3.23.2
- [FIXED] Type validation now works with non-strings due to updated validator@5.0.0 [#5861](https://github.com/sequelize/sequelize/pull/5861)
......
......@@ -671,7 +671,7 @@ To obtain Instances for the newly created values, you will need to query for the
| [options.hooks=true] | Boolean | Run before / after bulk create hooks? |
| [options.individualHooks=false] | Boolean | Run before / after create hooks for each individual Instance? BulkCreate hooks will still be run if options.hooks is true. |
| [options.ignoreDuplicates=false] | Boolean | Ignore duplicate values for primary keys? (not supported by postgres) |
| [options.updateOnDuplicate] | Array | Fields to update if row key already exists (on duplicate key update)? (only supported by mysql & mariadb). By default, all fields are updated. |
| [options.updateOnDuplicate] | Array | Fields to update if row key already exists (on duplicate key update)? (only supported by mysql). By default, all fields are updated. |
| [options.transaction] | Transaction | Transaction to run query under |
| [options.logging=false] | Function | A function that gets executed while running the query to log the sql. |
| [options.returning=false] | Boolean | Append RETURNING * to get back auto generated values (Postgres only) |
......@@ -775,7 +775,7 @@ of affected rows, while the second element is the actual affected rows (only sup
| [options.sideEffects=true] | Boolean | Whether or not to update the side effects of any virtual setters. |
| [options.individualHooks=false] | Boolean | Run before / after update hooks?. If true, this will execute a SELECT followed by individual UPDATEs. A select is needed, because the row data needs to be passed to the hooks |
| [options.returning=false] | Boolean | Return the affected rows (only for postgres) |
| [options.limit] | Number | How many rows to update (only for mysql and mariadb) |
| [options.limit] | Number | How many rows to update (only for mysql) |
| [options.logging=false] | Function | A function that gets executed while running the query to log the sql. |
| [options.benchmark=false] | Boolean | Print query execution time in milliseconds when logging SQL. |
| [options.transaction] | Transaction | Transaction to run query under |
......@@ -792,4 +792,4 @@ Run a describe query on the table. The result will be return to the listener as
***
_This document is automatically generated based on source code comments. Please do not edit it directly, as your changes will be ignored. Please write on <a href="irc://irc.freenode.net/#sequelizejs">IRC</a>, open an issue or a create a pull request if you feel something can be improved. For help on how to write source code documentation see [JSDoc](http://usejsdoc.org) and [dox](https://github.com/tj/dox)_
\ No newline at end of file
_This document is automatically generated based on source code comments. Please do not edit it directly, as your changes will be ignored. Please write on <a href="irc://irc.freenode.net/#sequelizejs">IRC</a>, open an issue or a create a pull request if you feel something can be improved. For help on how to write source code documentation see [JSDoc](http://usejsdoc.org) and [dox](https://github.com/tj/dox)_
......@@ -45,7 +45,7 @@ var sequelize = new Sequelize('mysql://localhost:3306/database', {})
| [username=null] | String | The username which is used to authenticate against the database. |
| [password=null] | String | The password which is used to authenticate against the database. |
| [options={}] | Object | An object with options. |
| [options.dialect='mysql'] | String | The dialect of the database you are connecting to. One of mysql, postgres, sqlite, mariadb and mssql. |
| [options.dialect='mysql'] | String | The dialect of the database you are connecting to. One of mysql, postgres, sqlite and mssql. |
| [options.dialectModulePath=null] | String | If specified, load the dialect library from this path. For example, if you want to use pg.js instead of pg when connecting to a pg database, you should specify 'pg.js' here |
| [options.dialectOptions] | Object | An object of additional options, which are passed directly to the connection library |
| [options.storage] | String | Only used by sqlite. Defaults to ':memory:' |
......
......@@ -35,7 +35,6 @@ $ npm install --save sequelize
$ npm install --save pg # for postgres
$ npm install --save mysql # for mysql
$ npm install --save sqlite3 # for sqlite
$ npm install --save mariasql # for mariasql
```
## Connecting to the database
......@@ -45,7 +44,7 @@ Open the created directory in your favorite text editor and add a new file calle
```js
var Sequelize = require('sequelize')
, sequelize = new Sequelize('database_name', 'username', 'password', {
dialect: "mysql", // or 'sqlite', 'postgres', 'mariadb', 'mssql'
dialect: "mysql", // or 'sqlite', 'postgres', 'mssql'
port: 3306 // or 5432 (for postgres)
});
......
......@@ -7,7 +7,7 @@ $ npm install --save sequelize
# And one of the following:
$ npm install --save pg pg-hstore
$ npm install --save mysql // For both mysql and mariadb dialects
$ npm install --save mysql
$ npm install --save sqlite3
$ npm install --save tedious // MSSQL
```
......@@ -19,7 +19,7 @@ Sequelize will setup a connection pool on initialization so you should ideally o
```js
var sequelize = new Sequelize('database', 'username', 'password', {
host: 'localhost',
dialect: 'mysql'|'mariadb'|'sqlite'|'postgres'|'mssql',
dialect: 'mysql'|'sqlite'|'postgres'|'mssql',
pool: {
max: 5,
......
......@@ -53,12 +53,12 @@ var sequelize = new Sequelize('database', 'username', 'password', {
 
// the sql dialect of the database
// - default is 'mysql'
// - currently supported: 'mysql', 'sqlite', 'postgres', 'mariadb', 'mssql'
// - currently supported: 'mysql', 'sqlite', 'postgres', 'mssql'
dialect: 'mysql',
 
// you can also pass any dialect options to the underlying dialect library
// - default is empty
// - currently supported: 'mysql', 'mariadb', 'postgres', 'mssql'
// - currently supported: 'mysql', 'postgres', 'mssql'
dialectOptions: {
socketPath: '/Applications/MAMP/tmp/mysql/mysql.sock',
supportBigNumbers: true,
......@@ -181,18 +181,7 @@ var sequelize = new Sequelize('database', 'username', 'password', {
**Note:** You can pass options directly to dialect library by setting the
`dialectOptions` parameter. See [Options][0]
for examples (currently only mysql and mariadb are supported).
### MariaDB
For MariaDB compatibility you have to install the package `mariasql@~0.1.20`.
The configuration needs to look like this:
```js
var sequelize = new Sequelize('database', 'username', 'password', {
dialect: 'mariadb'
})
```
for examples (currently only mysql is supported).
### SQLite
......
......@@ -3,8 +3,7 @@
<span>Sequelize</span>
</div>
Sequelize is a promise-based ORM for Node.js and io.js. It supports the dialects PostgreSQL, MySQL,
MariaDB, SQLite and MSSQL and features solid transaction support, relations, read replication and
Sequelize is a promise-based ORM for Node.js and io.js. It supports the dialects PostgreSQL, MySQL, SQLite and MSSQL and features solid transaction support, relations, read replication and
more.
[Installation](docs/getting-started/)
......
......@@ -986,7 +986,6 @@ _.each(dataTypes, function (dataType) {
dataTypes.postgres = require('./dialects/postgres/data-types')(dataTypes);
dataTypes.mysql = require('./dialects/mysql/data-types')(dataTypes);
dataTypes.mariadb = dataTypes.mysql;
dataTypes.sqlite = require('./dialects/sqlite/data-types')(dataTypes);
dataTypes.mssql = require('./dialects/mssql/data-types')(dataTypes);
......
......@@ -38,12 +38,7 @@ ConnectionManager = function(dialect, sequelize) {
ConnectionManager.prototype.refreshTypeParser = function(dataTypes) {
_.each(dataTypes, function (dataType, key) {
if (dataType.hasOwnProperty('parse')) {
var dialectName = this.dialectName;
if (dialectName === 'mariadb') {
dialectName = 'mysql';
}
if (dataType.types[dialectName]) {
if (dataType.types[this.dialectName]) {
this.$refreshTypeParser(dataType);
} else {
throw new Error('Parse function not supported for type ' + dataType.key + ' in dialect ' + this.dialectName);
......
'use strict';
var MySQLDialect = require('../mysql')
, util = require('util');
var MariaDialect = function(sequelize) {
MySQLDialect.call(this, sequelize);
};
util.inherits(MariaDialect, MySQLDialect);
MariaDialect.prototype.name = 'mariadb';
module.exports = MariaDialect;
......@@ -2109,7 +2109,7 @@ Model.prototype.insertOrUpdate = Model.prototype.upsert;
* @param {Boolean} [options.hooks=true] Run before / after bulk create hooks?
* @param {Boolean} [options.individualHooks=false] Run before / after create hooks for each individual Instance? BulkCreate hooks will still be run if options.hooks is true.
* @param {Boolean} [options.ignoreDuplicates=false] Ignore duplicate values for primary keys? (not supported by postgres)
* @param {Array} [options.updateOnDuplicate] Fields to update if row key already exists (on duplicate key update)? (only supported by mysql & mariadb). By default, all fields are updated.
* @param {Array} [options.updateOnDuplicate] Fields to update if row key already exists (on duplicate key update)? (only supported by mysql). By default, all fields are updated.
* @param {Transaction} [options.transaction] Transaction to run query under
* @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql.
* @param {Boolean} [options.benchmark=false] Pass query execution time in milliseconds as second argument to logging function (options.logging).
......@@ -2136,7 +2136,7 @@ Model.prototype.bulkCreate = function(records, options) {
if (options.ignoreDuplicates && ['postgres', 'mssql'].indexOf(dialect) !== -1) {
return Promise.reject(new Error(dialect + ' does not support the \'ignoreDuplicates\' option.'));
}
if (options.updateOnDuplicate && ['mysql', 'mariadb'].indexOf(dialect) === -1) {
if (options.updateOnDuplicate && dialect !== 'mysql') {
return Promise.reject(new Error(dialect + ' does not support the \'updateOnDuplicate\' option.'));
}
......@@ -2445,7 +2445,7 @@ Model.prototype.restore = function(options) {
* @param {Boolean} [options.sideEffects=true] Whether or not to update the side effects of any virtual setters.
* @param {Boolean} [options.individualHooks=false] Run before / after update hooks?. If true, this will execute a SELECT followed by individual UPDATEs. A select is needed, because the row data needs to be passed to the hooks
* @param {Boolean} [options.returning=false] Return the affected rows (only for postgres)
* @param {Number} [options.limit] How many rows to update (only for mysql and mariadb)
* @param {Number} [options.limit] How many rows to update (only for mysql)
* @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql.
* @param {Boolean} [options.benchmark=false] Pass query execution time in milliseconds as second argument to logging function (options.logging).
* @param {Transaction} [options.transaction] Transaction to run query under
......
......@@ -364,8 +364,7 @@ QueryInterface.prototype.removeColumn = function(tableName, attributeName, optio
// mssql needs special treatment as it cannot drop a column with a default or foreign key constraint
return MSSSQLQueryInterface.removeColumn.call(this, tableName, attributeName, options);
case 'mysql':
case 'mariadb':
// mysql/maria needs special treatment as it cannot drop a column with a foreign key constraint
// mysql needs special treatment as it cannot drop a column with a foreign key constraint
return MySQLQueryInterface.removeColumn.call(this, tableName, attributeName, options);
default:
var sql = this.QueryGenerator.removeColumnQuery(tableName, attributeName);
......
......@@ -64,7 +64,7 @@ var url = require('url')
* @param {String} [options.username=null] The username which is used to authenticate against the database.
* @param {String} [options.password=null] The password which is used to authenticate against the database.
* @param {String} [options.database=null] The name of the database
* @param {String} [options.dialect='mysql'] The dialect of the database you are connecting to. One of mysql, postgres, sqlite, mariadb and mssql.
* @param {String} [options.dialect='mysql'] The dialect of the database you are connecting to. One of mysql, postgres, sqlite and mssql.
* @param {String} [options.dialectModulePath=null] If specified, load the dialect library from this path. For example, if you want to use pg.js instead of pg when connecting to a pg database, you should specify 'pg.js' here
* @param {Object} [options.dialectOptions] An object of additional options, which are passed directly to the connection library
* @param {String} [options.storage] Only used by sqlite. Defaults to ':memory:'
......@@ -216,9 +216,6 @@ var Sequelize = function(database, username, password, options) {
// Requiring the dialect in a switch-case to keep the
// require calls static. (Browserify fix)
switch (this.getDialect()){
case 'mariadb':
Dialect = require('./dialects/mariadb');
break;
case 'mssql':
Dialect = require('./dialects/mssql');
break;
......@@ -232,7 +229,7 @@ var Sequelize = function(database, username, password, options) {
Dialect = require('./dialects/sqlite');
break;
default:
throw new Error('The dialect ' + this.getDialect() + ' is not supported. Supported dialects: mariadb, mssql, mysql, postgres, and sqlite.');
throw new Error('The dialect ' + this.getDialect() + ' is not supported. Supported dialects: mssql, mysql, postgres, and sqlite.');
}
this.dialect = new Dialect(this);
......@@ -873,7 +870,7 @@ Sequelize.prototype.set = function( variables, options ) {
// Prepare options
options = Utils._.extend({}, this.options.set, typeof options === 'object' && options || {});
if (['mysql', 'mariadb'].indexOf(this.options.dialect) === -1) {
if (this.options.dialect !== 'mysql') {
throw new Error('sequelize.set is only supported for mysql');
}
if (!options.transaction || !(options.transaction instanceof Transaction) ) {
......
site_name: Sequelize | The Node.js / io.js ORM for PostgreSQL, MySQL, SQLite and MSSQL
site_description: Sequelize is an ORM for Node.js and io.js. It supports the dialects PostgreSQL, MySQL, MariaDB, SQLite and MSSQL.
site_description: Sequelize is an ORM for Node.js and io.js. It supports the dialects PostgreSQL, MySQL, SQLite and MSSQL.
repo_url: https://github.com/sequelize/sequelize
site_favicon: favicon.ico
site_url: http://docs.sequelizejs.com
......
......@@ -58,6 +58,7 @@
"chai-spies": "^0.7.0",
"commander": "^2.6.0",
"continuation-local-storage": "^3.1.4",
"coveralls": "^2.11.9",
"dox": "~0.8.0",
"git": "^0.1.5",
"hints": "^0.2.0",
......@@ -88,7 +89,7 @@
],
"main": "index",
"scripts": {
"test": "if [ $COVERAGE ]; then npm run codeclimate; else npm run jshint && npm run teaser && npm run test-unit && npm run test-integration; fi",
"test": "if [ $COVERAGE ]; then npm run coveralls; else npm run jshint && npm run teaser && npm run test-unit && npm run test-integration; fi",
"test-docker": "docker-compose run sequelize /bin/sh -c \"npm run test-all\"",
"test-docker-unit": "docker-compose run sequelize /bin/sh -c \"npm run test-unit-all\"",
"test-docker-integration": "docker-compose run sequelize /bin/sh -c \"npm run test-integration-all\"",
......@@ -100,38 +101,29 @@
"test-unit-mysql": "DIALECT=mysql npm run test-unit",
"test-unit-postgres": "DIALECT=postgres npm run test-unit",
"test-unit-postgres-native": "DIALECT=postgres-native npm run test-unit",
"test-unit-mariadb": "DIALECT=mariadb npm run test-unit",
"test-unit-sqlite": "DIALECT=sqlite npm run test-unit",
"test-unit-mssql": "DIALECT=mssql npm run test-unit",
"test-unit-all": "npm run test-unit-mysql && npm run test-unit-postgres && npm run test-unit-postgres-native && npm run test-unit-mssql && npm run test-unit-sqlite && npm run test-unit-mariadb",
"test-unit-all": "npm run test-unit-mysql && npm run test-unit-postgres && npm run test-unit-postgres-native && npm run test-unit-mssql && npm run test-unit-sqlite",
"test-integration": "./node_modules/.bin/mocha --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 15000 --reporter spec --grep \"$GREP\" 'test/integration/**/*.test.js'",
"test-integration-mysql": "DIALECT=mysql npm run test-integration",
"test-integration-postgres": "DIALECT=postgres npm run test-integration",
"test-integration-postgres-native": "DIALECT=postgres-native npm run test-integration",
"test-integration-mariadb": "DIALECT=mariadb npm run test-integration",
"test-integration-sqlite": "DIALECT=sqlite npm run test-integration",
"test-integration-mssql": "DIALECT=mssql npm run test-integration",
"test-integration-all": "npm run test-integration-mysql && npm run test-integration-postgres && npm run test-integration-postgres-native && npm run test-integration-mssql && npm run test-integration-sqlite && npm run test-integration-mariadb",
"test-integration-all": "npm run test-integration-mysql && npm run test-integration-postgres && npm run test-integration-postgres-native && npm run test-integration-mssql && npm run test-integration-sqlite",
"test-mysql": "DIALECT=mysql npm test",
"test-sqlite": "DIALECT=sqlite npm test",
"test-postgres": "DIALECT=postgres npm test",
"test-pgsql": "npm run test-postgres",
"test-postgres-native": "DIALECT=postgres-native npm test",
"test-postgresn": "npm run test-postgres-native",
"test-mariadb": "DIALECT=mariadb npm test",
"test-mssql": "DIALECT=mssql npm test",
"test-all": "npm run test-mysql && npm run test-sqlite && npm run test-postgres && npm run test-postgres-native && npm run test-mariadb && npm run test-mssql",
"cover": "rm -rf coverage && npm run teaser && COVERAGE=true ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -t 30000 --ui tdd 'test/integration/**/*.test.js'",
"cover-mysql": "DIALECT=mysql npm run cover && mv coverage coverage-mysql",
"cover-sqlite": "DIALECT=sqlite npm run cover && mv coverage coverage-sqlite",
"cover-postgres": "DIALECT=postgres npm run cover && mv coverage coverage-postgres",
"cover-postgres-native": "DIALECT=postgres-native npm run cover && mv coverage coverage-postgres-native",
"cover-mariadb": "DIALECT=mariadb npm run cover && mv coverage coverage-mariadb",
"cover-mssql": "DIALECT=mssql npm run cover && mv coverage coverage-mssql",
"cover-all": "npm run cover-mysql && npm run cover-postgres && npm run cover-postgres-native && npm run cover-mssql && npm run cover-sqlite && npm run cover-mariadb && npm run merge-coverage",
"merge-coverage": "rm -rf coverage && mkdir coverage && ./node_modules/.bin/lcov-result-merger 'coverage-*/lcov.info' 'coverage/lcov.info'",
"codeclimate-send": "npm install -g codeclimate-test-reporter && CODECLIMATE_REPO_TOKEN=ce835a510bbf423a5ab5400a9bdcc2ec2d189d840b31657c6ee7cb9916b161d6 codeclimate-test-reporter < coverage/lcov.info",
"codeclimate": "npm run cover-all && npm run codeclimate-send",
"test-all": "npm run test-mysql && npm run test-sqlite && npm run test-postgres && npm run test-postgres-native && npm run test-mssql",
"cover": "rm -rf coverage && npm run teaser && npm run cover-integration && npm run cover-unit && npm run merge-coverage",
"cover-integration": "COVERAGE=true ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -t 30000 --ui tdd 'test/integration/**/*.test.js' && mv coverage/lcov.info coverage/integration.info",
"cover-unit": "COVERAGE=true ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -t 30000 --ui tdd 'test/unit/**/*.test.js'&& mv coverage/lcov.info coverage/unit.info",
"merge-coverage": "./node_modules/.bin/lcov-result-merger 'coverage/*.info' 'coverage/lcov.info'",
"coveralls": "npm run cover && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",
"sscce": "docker-compose run sequelize /bin/sh -c \"node sscce.js\"",
"sscce-mysql": "DIALECT=mysql npm run sscce",
"sscce-postgres": "DIALECT=postgres npm run sscce",
......
......@@ -56,17 +56,5 @@ module.exports = {
max: process.env.SEQ_PG_POOL_MAX || process.env.SEQ_POOL_MAX || 5,
idle: process.env.SEQ_PG_POOL_IDLE || process.env.SEQ_POOL_IDLE || 3000
}
},
mariadb: {
database: process.env.SEQ_MYSQL_DB || process.env.SEQ_DB || 'sequelize_test',
username: process.env.SEQ_MYSQL_USER || process.env.SEQ_USER || 'root',
password: process.env.SEQ_MYSQL_PW || process.env.SEQ_PW || null,
host: process.env.SEQ_MYSQL_HOST || process.env.SEQ_HOST || '127.0.0.1',
port: process.env.SEQ_MYSQL_PORT || process.env.SEQ_PORT || 3306,
pool: {
max: process.env.SEQ_MYSQL_POOL_MAX || process.env.SEQ_POOL_MAX || 5,
idle: process.env.SEQ_MYSQL_POOL_IDLE || process.env.SEQ_POOL_IDLE || 3000
}
}
};
......@@ -16,12 +16,6 @@ var chai = require('chai')
describe(Support.getTestDialectTeaser('Configuration'), function() {
describe('Connections problems should fail with a nice message', function() {
it('when we don\'t have the correct server details', function() {
if (dialect === 'mariadb') {
console.log('This dialect doesn\'t support me :(');
expect(true).to.be.true; // Silence Buster
return;
}
var seq = new Sequelize(config[dialect].database, config[dialect].username, config[dialect].password, {storage: '/path/to/no/where/land', logging: false, host: '0.0.0.1', port: config[dialect].port, dialect: dialect});
if (dialect === 'sqlite') {
// SQLite doesn't have a breakdown of error codes, so we are unable to discern between the different types of errors.
......@@ -32,12 +26,6 @@ describe(Support.getTestDialectTeaser('Configuration'), function() {
});
it('when we don\'t have the correct login information', function() {
if (dialect === 'mariadb') {
console.log('This dialect doesn\'t support me :(');
expect(true).to.be.true; // Silence Buster
return;
}
if (dialect === 'mssql') {
// NOTE: Travis seems to be having trouble with this test against the
// AWS instance. Works perfectly fine on a local setup.
......@@ -57,7 +45,7 @@ describe(Support.getTestDialectTeaser('Configuration'), function() {
it('when we don\'t have a valid dialect.', function() {
expect(function() {
new Sequelize(config[dialect].database, config[dialect].username, config[dialect].password, {host: '0.0.0.1', port: config[dialect].port, dialect: 'some-fancy-dialect'});
}).to.throw(Error, 'The dialect some-fancy-dialect is not supported. Supported dialects: mariadb, mssql, mysql, postgres, and sqlite.');
}).to.throw(Error, 'The dialect some-fancy-dialect is not supported. Supported dialects: mssql, mysql, postgres, and sqlite.');
});
});
......
......@@ -248,7 +248,7 @@ describe(Support.getTestDialectTeaser('DataTypes'), function() {
it('calls parse and stringify for GEOMETRY', function () {
var Type = new Sequelize.GEOMETRY();
if (['postgres', 'mysql', 'mariadb'].indexOf(dialect) !== -1) {
if (['postgres', 'mysql'].indexOf(dialect) !== -1) {
return testSuccess(Type, { type: "Point", coordinates: [125.6, 10.1] });
} else {
// Not implemented yet
......@@ -292,7 +292,7 @@ describe(Support.getTestDialectTeaser('DataTypes'), function() {
//This case throw unhandled exception
return User.findAll();
}).then(function(users){
if (Support.dialectIsMySQL()) {
if (dialect === 'mysql') {
// MySQL will return NULL, becuase they lack EMPTY geometry data support.
expect(users[0].field).to.be.eql(null);
} else if (dialect === 'postgres' || dialect === 'postgres-native') {
......
......@@ -4,9 +4,10 @@
var chai = require('chai')
, expect = chai.expect
, Support = require(__dirname + '/../../support')
, dialect = Support.getTestDialect()
, DataTypes = require(__dirname + '/../../../../lib/data-types');
if (Support.dialectIsMySQL()) {
if (dialect === 'mysql') {
describe('[MYSQL Specific] Associations', function() {
describe('many-to-many', function() {
describe('where tables have the same prefix', function() {
......
......@@ -4,10 +4,11 @@
var chai = require('chai')
, expect = chai.expect
, Support = require(__dirname + '/../../support')
, dialect = Support.getTestDialect()
, sinon = require('sinon')
, DataTypes = require(__dirname + '/../../../../lib/data-types');
if (Support.dialectIsMySQL()) {
if (dialect === 'mysql') {
describe('[MYSQL Specific] Connector Manager', function() {
it('works correctly after being idle', function() {
var User = this.sequelize.define('User', { username: DataTypes.STRING })
......@@ -55,7 +56,7 @@ if (Support.dialectIsMySQL()) {
});
// This should run only on direct mysql
if (Support.dialectIsMySQL(true)) {
if (dialect === 'mysql') {
it('should maintain connection', function() {
var sequelize = Support.createSequelizeInstance({pool: {min: 1, max: 1, handleDisconnects: true, idle: 5000}})
, cm = sequelize.connectionManager
......
......@@ -4,10 +4,11 @@
var chai = require('chai')
, expect = chai.expect
, Support = require(__dirname + '/../../support')
, dialect = Support.getTestDialect()
, DataTypes = require(__dirname + '/../../../../lib/data-types')
, config = require(__dirname + '/../../../config/config');
if (Support.dialectIsMySQL()) {
if (dialect === 'mysql') {
describe('[MYSQL Specific] DAOFactory', function() {
describe('constructor', function() {
it('handles extended attributes (unique)', function() {
......
......@@ -1140,7 +1140,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
});
}
if (Support.dialectIsMySQL()) {
if (dialect === 'mysql') {
it('supports limit clause', function() {
var self = this
, data = [{ username: 'Peter', secretValue: '42' },
......@@ -2135,7 +2135,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
});
});
if (Support.dialectIsMySQL() || dialect === 'sqlite') {
if (dialect === 'mysql' || dialect === 'sqlite') {
it('should take schemaDelimiter into account if applicable', function() {
var test = 0;
var UserSpecialUnderscore = this.sequelize.define('UserSpecialUnderscore', {age: Sequelize.INTEGER}, {schema: 'hello', schemaDelimiter: '_'});
......@@ -2175,7 +2175,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
return UserPublic.schema('special').sync({ force: true }).then(function() {
return self.sequelize.queryInterface.describeTable('Publics', {
logging: function(sql) {
if (dialect === 'sqlite' || Support.dialectIsMySQL() || dialect === 'mssql') {
if (dialect === 'sqlite' || dialect === 'mysql' || dialect === 'mssql') {
expect(sql).to.not.contain('special');
count++;
}
......@@ -2188,7 +2188,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
return self.sequelize.queryInterface.describeTable('Publics', {
schema: 'special',
logging: function(sql) {
if (dialect === 'sqlite' || Support.dialectIsMySQL() || dialect === 'mssql') {
if (dialect === 'sqlite' || dialect === 'mysql' || dialect === 'mssql') {
expect(sql).to.contain('special');
count++;
}
......@@ -2331,7 +2331,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
return Post.sync({logging: _.once(function(sql) {
if (dialect === 'postgres') {
expect(sql).to.match(/"authorId" INTEGER REFERENCES "authors" \("id"\)/);
} else if (Support.dialectIsMySQL()) {
} else if (dialect === 'mysql') {
expect(sql).to.match(/FOREIGN KEY \(`authorId`\) REFERENCES `authors` \(`id`\)/);
} else if (dialect === 'mssql') {
expect(sql).to.match(/FOREIGN KEY \(\[authorId\]\) REFERENCES \[authors\] \(\[id\]\)/);
......@@ -2356,7 +2356,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
return Post.sync({logging: _.once(function(sql) {
if (dialect === 'postgres') {
expect(sql).to.match(/"authorId" INTEGER REFERENCES "authors" \("id"\)/);
} else if (Support.dialectIsMySQL()) {
} else if (dialect === 'mysql') {
expect(sql).to.match(/FOREIGN KEY \(`authorId`\) REFERENCES `authors` \(`id`\)/);
} else if (dialect === 'sqlite') {
expect(sql).to.match(/`authorId` INTEGER REFERENCES `authors` \(`id`\)/);
......@@ -2388,10 +2388,8 @@ describe(Support.getTestDialectTeaser('Model'), function() {
return;
}).catch (function(err) {
if (Support.dialectIsMySQL(true)) {
if (dialect === 'mysql') {
expect(err.message).to.match(/ER_CANNOT_ADD_FOREIGN|ER_CANT_CREATE_TABLE/);
} else if (dialect === 'mariadb') {
expect(err.message).to.match(/Can\'t create table/);
} else if (dialect === 'sqlite') {
// the parser should not end up here ... see above
expect(1).to.equal(2);
......
......@@ -705,7 +705,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
it('is possible to use casting when creating an instance', function() {
var self = this
, type = Support.dialectIsMySQL() ? 'signed' : 'integer'
, type = dialect === 'mysql' ? 'signed' : 'integer'
, match = false;
return this.User.create({
......@@ -728,7 +728,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
, type = this.sequelize.cast(this.sequelize.cast(this.sequelize.literal('1-2'), 'integer'), 'integer')
, match = false;
if (Support.dialectIsMySQL()) {
if (dialect === 'mysql') {
type = this.sequelize.cast(this.sequelize.cast(this.sequelize.literal('1-2'), 'unsigned'), 'signed');
}
......@@ -736,7 +736,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
intVal: type
}, {
logging: function(sql) {
if (Support.dialectIsMySQL()) {
if (dialect === 'mysql') {
expect(sql).to.contain('CAST(CAST(1-2 AS UNSIGNED) AS SIGNED)');
} else {
expect(sql).to.contain('CAST(CAST(1-2 AS INTEGER) AS INTEGER)');
......@@ -755,7 +755,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
var self = this;
return this.User.create({
intVal: this.sequelize.literal('CAST(1-2 AS ' + (Support.dialectIsMySQL() ? 'SIGNED' : 'INTEGER') + ')')
intVal: this.sequelize.literal('CAST(1-2 AS ' + (dialect === 'mysql' ? 'SIGNED' : 'INTEGER') + ')')
}).then(function(user) {
return self.User.findById(user.id).then(function(user) {
expect(user.intVal).to.equal(-1);
......@@ -918,7 +918,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
return UserNull.create({ username: 'foo2', smth: null }).catch(function(err) {
expect(err).to.exist;
expect(err.get('smth')[0].path).to.equal('smth');
if (Support.dialectIsMySQL()) {
if (dialect === 'mysql') {
// We need to allow two different errors for MySQL, see:
// http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html#sqlmode_strict_trans_tables
expect(err.get('smth')[0].type).to.match(/notNull Violation/);
......@@ -1403,7 +1403,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
expect(sql.indexOf('INSERT INTO "Beers" ("id","style","createdAt","updatedAt") VALUES (DEFAULT')).not.be.equal(-1);
} else if (dialect === 'mssql') {
expect(sql.indexOf('INSERT INTO [Beers] ([style],[createdAt],[updatedAt]) VALUES')).not.be.equal(-1);
} else { // mysql, sqlite, mariadb
} else { // mysql, sqlite
expect(sql.indexOf('INSERT INTO `Beers` (`id`,`style`,`createdAt`,`updatedAt`) VALUES (NULL')).not.be.equal(-1);
}
}
......
......@@ -9,6 +9,7 @@ var chai = require('chai')
, expect = chai.expect
, moment = require('moment')
, Support = require(__dirname + '/../support')
, dialect = Support.getTestDialect()
, DataTypes = require(__dirname + '/../../../lib/data-types')
, config = require(__dirname + '/../../config/config')
, current = Support.sequelize;
......@@ -74,7 +75,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
});
});
if (Support.dialectIsMySQL()) {
if (dialect === 'mysql') {
// Bit fields interpreted as boolean need conversion from buffer / bool.
// Sqlite returns the inserted value as is, and postgres really should the built in bool type instead
......
......@@ -22,7 +22,7 @@ var chai = require('chai')
var qq = function(str) {
if (dialect === 'postgres' || dialect === 'mssql') {
return '"' + str + '"';
} else if (Support.dialectIsMySQL() || dialect === 'sqlite') {
} else if (dialect === 'mysql' || dialect === 'sqlite') {
return '`' + str + '`';
} else {
return str;
......@@ -128,9 +128,7 @@ describe(Support.getTestDialectTeaser('Sequelize'), function() {
expect(
err.message.match(/connect ECONNREFUSED/) ||
err.message.match(/invalid port number/) ||
err.message.match(/Port should be > 0 and < 65536/) ||
err.message.match(/port should be > 0 and < 65536/) ||
err.message.match(/port should be >= 0 and < 65536: 99999/) ||
err.message.match(/should be >=? 0 and < 65536/) ||
err.message.match(/Login failed for user/)
).to.be.ok;
});
......@@ -268,7 +266,7 @@ describe(Support.getTestDialectTeaser('Sequelize'), function() {
});
// We can only test MySQL warnings when using MySQL.
if (Support.dialectIsMySQL()) {
if (dialect === 'mysql') {
it('logs warnings when there are warnings', function() {
var logger = sinon.spy();
var sequelize = Support.createSequelizeInstance({
......@@ -370,7 +368,7 @@ describe(Support.getTestDialectTeaser('Sequelize'), function() {
});
});
if (Support.dialectIsMySQL()) {
if (dialect === 'mysql') {
it('executes stored procedures', function() {
var self = this;
return self.sequelize.query(this.insertQuery).then(function() {
......@@ -898,7 +896,7 @@ describe(Support.getTestDialectTeaser('Sequelize'), function() {
});
});
if (Support.dialectIsMySQL()) {
if (dialect === 'mysql') {
describe('set', function() {
it("should return an promised error if transaction isn't defined", function() {
expect(function() {
......
......@@ -38,7 +38,7 @@ if (dialect !== 'sqlite') {
});
});
if (Support.dialectIsMySQL()) {
if (dialect === 'mysql') {
it('handles existing timestamps', function() {
var NormalUser = this.sequelize.define('user', {})
, TimezonedUser = this.sequelizeWithTimezone.define('user', {});
......
......@@ -166,19 +166,6 @@ var Support = {
return envDialect;
},
dialectIsMySQL: function(strict) {
var envDialect = process.env.DIALECT || 'mysql';
if (strict === undefined) {
strict = false;
}
if (strict) {
return envDialect === 'mysql';
} else {
return ['mysql', 'mariadb'].indexOf(envDialect) !== -1;
}
},
getTestDialectTeaser: function(moduleName) {
var dialect = this.getTestDialect();
......@@ -211,10 +198,6 @@ var Support = {
expectsql: function(query, expectations) {
var expectation = expectations[Support.sequelize.dialect.name];
if (!expectation && Support.sequelize.dialect.name === 'mariadb') {
expectation = expectations.mysql;
}
if (!expectation) {
expectation = expectations['default']
.replace(/\[/g, Support.sequelize.dialect.TICK_CHAR_LEFT)
......
......@@ -93,7 +93,7 @@ describe('Sequelize', function() {
, config = sequelize.config
, port;
if (Support.dialectIsMySQL()) {
if (dialect === 'mysql') {
port = 3306;
} else if (dialect === 'postgres' || dialect === 'postgres-native') {
port = 5432;
......
......@@ -4,10 +4,11 @@
var chai = require('chai')
, expect = chai.expect
, Support = require(__dirname + '/../../support')
, dialect = Support.getTestDialect()
, _ = require('lodash')
, QueryGenerator = require('../../../../lib/dialects/mysql/query-generator');
if (Support.dialectIsMySQL()) {
if (dialect === 'mysql') {
describe('[MYSQL Specific] QueryGenerator', function() {
var suites = {
attributesToSQL: [
......@@ -47,7 +48,7 @@ if (Support.dialectIsMySQL()) {
arguments: [{id: {type: 'INTEGER', after: 'Bar'}}],
expectation: {id: 'INTEGER AFTER `Bar`'}
},
// New references style
{
arguments: [{id: {type: 'INTEGER', references: { model: 'Bar' }}}],
......
......@@ -72,29 +72,25 @@ suite(Support.getTestDialectTeaser('SQL'), function() {
testsql('TEXT("tiny")', DataTypes.TEXT('tiny'), {
default: 'TEXT',
mssql: 'NVARCHAR(256)',
mysql: 'TINYTEXT',
mariadb: 'TINYTEXT'
mysql: 'TINYTEXT'
});
testsql('TEXT({ length: "tiny" })', DataTypes.TEXT({ length: 'tiny' }), {
default: 'TEXT',
mssql: 'NVARCHAR(256)',
mysql: 'TINYTEXT',
mariadb: 'TINYTEXT'
mysql: 'TINYTEXT'
});
testsql('TEXT("medium")', DataTypes.TEXT('medium'), {
default: 'TEXT',
mssql: 'NVARCHAR(MAX)',
mysql: 'MEDIUMTEXT',
mariadb: 'MEDIUMTEXT'
mysql: 'MEDIUMTEXT'
});
testsql('TEXT("long")', DataTypes.TEXT('long'), {
default: 'TEXT',
mssql: 'NVARCHAR(MAX)',
mysql: 'LONGTEXT',
mariadb: 'LONGTEXT'
mysql: 'LONGTEXT'
});
suite('validate', function () {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!