query-generator.js 745 B

12345678910111213141516171819202122
  1. var Utils = require("../../utils")
  2. module.exports = (function() {
  3. var QueryGenerator = {
  4. dialect: 'mariadb',
  5. uniqueConstraintMapping: {
  6. code: 1062,
  7. map: function(str) {
  8. // we're manually remvoving uniq_ here for a future capability of defining column names explicitly
  9. var match = str.replace('uniq_', '').match(/Duplicate entry .* for key '(.*?)'$/)
  10. if (match === null || match.length < 2) {
  11. return false
  12. }
  13. return match[1].split('_')
  14. }
  15. },
  16. }
  17. // "MariaDB is a drop-in replacement for MySQL." - so thats exactly what we do, drop in the mysql query generator
  18. return Utils._.extend(Utils._.clone(require("../mysql/query-generator")), QueryGenerator)
  19. })()