index.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 { MySQLQueryInterface } = require('../mysql/query-interface');
  8. const DataTypes = require('../../data-types').mariadb;
  9. class MariadbDialect 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 MySQLQueryInterface(sequelize, this.queryGenerator);
  19. }
  20. }
  21. MariadbDialect.prototype.supports = _.merge(
  22. _.cloneDeep(AbstractDialect.prototype.supports), {
  23. 'VALUES ()': true,
  24. 'LIMIT ON UPDATE': true,
  25. lock: true,
  26. forShare: 'LOCK IN SHARE MODE',
  27. settingIsolationLevelDuringTransaction: false,
  28. schemas: true,
  29. inserts: {
  30. ignoreDuplicates: ' IGNORE',
  31. updateOnDuplicate: ' ON DUPLICATE KEY UPDATE'
  32. },
  33. index: {
  34. collate: false,
  35. length: true,
  36. parser: true,
  37. type: true,
  38. using: 1
  39. },
  40. constraints: {
  41. dropConstraint: false,
  42. check: false
  43. },
  44. indexViaAlter: true,
  45. indexHints: true,
  46. NUMERIC: true,
  47. GEOMETRY: true,
  48. JSON: true,
  49. REGEXP: true
  50. });
  51. MariadbDialect.prototype.defaultVersion = '10.1.44';
  52. MariadbDialect.prototype.Query = Query;
  53. MariadbDialect.prototype.QueryGenerator = QueryGenerator;
  54. MariadbDialect.prototype.DataTypes = DataTypes;
  55. MariadbDialect.prototype.name = 'mariadb';
  56. MariadbDialect.prototype.TICK_CHAR = '`';
  57. MariadbDialect.prototype.TICK_CHAR_LEFT = MariadbDialect.prototype.TICK_CHAR;
  58. MariadbDialect.prototype.TICK_CHAR_RIGHT = MariadbDialect.prototype.TICK_CHAR;
  59. module.exports = MariadbDialect;