index.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. 'use strict';
  2. const _ = require('lodash');
  3. const AbstractDialect = require('../abstract');
  4. const ConnectionManager = require('./connection-manager');
  5. const Query = require('./query');
  6. const QueryGenerator = require('./query-generator');
  7. const DataTypes = require('../../data-types').mssql;
  8. const { MSSqlQueryInterface } = require('./query-interface');
  9. class MssqlDialect extends AbstractDialect {
  10. constructor(sequelize) {
  11. super();
  12. this.sequelize = sequelize;
  13. this.connectionManager = new ConnectionManager(this, sequelize);
  14. this.queryGenerator = new QueryGenerator({
  15. _dialect: this,
  16. sequelize
  17. });
  18. this.queryInterface = new MSSqlQueryInterface(sequelize, this.queryGenerator);
  19. }
  20. }
  21. MssqlDialect.prototype.supports = _.merge(_.cloneDeep(AbstractDialect.prototype.supports), {
  22. 'DEFAULT': true,
  23. 'DEFAULT VALUES': true,
  24. 'LIMIT ON UPDATE': true,
  25. 'ORDER NULLS': false,
  26. lock: false,
  27. transactions: true,
  28. migrations: false,
  29. returnValues: {
  30. output: true
  31. },
  32. schemas: true,
  33. autoIncrement: {
  34. identityInsert: true,
  35. defaultValue: false,
  36. update: false
  37. },
  38. constraints: {
  39. restrict: false,
  40. default: true
  41. },
  42. index: {
  43. collate: false,
  44. length: false,
  45. parser: false,
  46. type: true,
  47. using: false,
  48. where: true
  49. },
  50. NUMERIC: true,
  51. tmpTableTrigger: true
  52. });
  53. MssqlDialect.prototype.defaultVersion = '12.0.2000'; // SQL Server 2014 Express
  54. MssqlDialect.prototype.Query = Query;
  55. MssqlDialect.prototype.name = 'mssql';
  56. MssqlDialect.prototype.TICK_CHAR = '"';
  57. MssqlDialect.prototype.TICK_CHAR_LEFT = '[';
  58. MssqlDialect.prototype.TICK_CHAR_RIGHT = ']';
  59. MssqlDialect.prototype.DataTypes = DataTypes;
  60. module.exports = MssqlDialect;