index.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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').sqlite;
  8. const { SQLiteQueryInterface } = require('./query-interface');
  9. class SqliteDialect 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 SQLiteQueryInterface(sequelize, this.queryGenerator);
  19. }
  20. }
  21. SqliteDialect.prototype.supports = _.merge(_.cloneDeep(AbstractDialect.prototype.supports), {
  22. 'DEFAULT': false,
  23. 'DEFAULT VALUES': true,
  24. 'UNION ALL': false,
  25. 'RIGHT JOIN': false,
  26. inserts: {
  27. ignoreDuplicates: ' OR IGNORE',
  28. updateOnDuplicate: ' ON CONFLICT DO UPDATE SET'
  29. },
  30. index: {
  31. using: false,
  32. where: true,
  33. functionBased: true
  34. },
  35. transactionOptions: {
  36. type: true
  37. },
  38. constraints: {
  39. addConstraint: false,
  40. dropConstraint: false
  41. },
  42. joinTableDependent: false,
  43. groupedLimit: false,
  44. JSON: true
  45. });
  46. SqliteDialect.prototype.defaultVersion = '3.8.0';
  47. SqliteDialect.prototype.Query = Query;
  48. SqliteDialect.prototype.DataTypes = DataTypes;
  49. SqliteDialect.prototype.name = 'sqlite';
  50. SqliteDialect.prototype.TICK_CHAR = '`';
  51. SqliteDialect.prototype.TICK_CHAR_LEFT = SqliteDialect.prototype.TICK_CHAR;
  52. SqliteDialect.prototype.TICK_CHAR_RIGHT = SqliteDialect.prototype.TICK_CHAR;
  53. module.exports = SqliteDialect;
  54. module.exports.SqliteDialect = SqliteDialect;
  55. module.exports.default = SqliteDialect;