UNPKG

sequelize-dm

Version:

Sequelize is a promise-based Node.js ORM tool for Postgres, MySQL, MariaDB, SQLite, Microsoft SQL Server, Amazon Redshift and Snowflake’s Data Cloud. It features solid transaction support, relations, eager and lazy loading, read replication and more.

67 lines (61 loc) 2.15 kB
'use strict'; const _ = require('lodash'); const { AbstractDialect } = require('../abstract'); const ConnectionManager = require('./connection-manager'); const Query = require('./query'); const QueryGenerator = require('./query-generator'); const DataTypes = require('../../data-types').snowflake; const { SnowflakeQueryInterface } = require('./query-interface'); class SnowflakeDialect extends AbstractDialect { static supports = _.merge(_.cloneDeep(AbstractDialect.supports), { 'VALUES ()': true, 'LIMIT ON UPDATE': true, lock: true, forShare: 'LOCK IN SHARE MODE', settingIsolationLevelDuringTransaction: false, inserts: { ignoreDuplicates: ' IGNORE', // disable for now, but could be enable by approach below // https://stackoverflow.com/questions/54828745/how-to-migrate-on-conflict-do-nothing-from-postgresql-to-snowflake // updateOnDuplicate: true }, index: { collate: false, length: true, parser: true, type: true, using: 1, }, constraints: { dropConstraint: false, check: false, }, indexViaAlter: true, indexHints: true, NUMERIC: true, // disable for now, need more work to enable the GEOGRAPHY MAPPING // GEOMETRY: true, // JSON: true, REGEXP: true, schemas: true, }); constructor(sequelize) { super(); this.sequelize = sequelize; this.connectionManager = new ConnectionManager(this, sequelize); this.queryGenerator = new QueryGenerator({ _dialect: this, sequelize, }); this.queryInterface = new SnowflakeQueryInterface(sequelize, this.queryGenerator); } } SnowflakeDialect.prototype.defaultVersion = '5.7.0'; SnowflakeDialect.prototype.Query = Query; SnowflakeDialect.prototype.QueryGenerator = QueryGenerator; SnowflakeDialect.prototype.DataTypes = DataTypes; SnowflakeDialect.prototype.name = 'snowflake'; SnowflakeDialect.prototype.TICK_CHAR = '"'; SnowflakeDialect.prototype.TICK_CHAR_LEFT = SnowflakeDialect.prototype.TICK_CHAR; SnowflakeDialect.prototype.TICK_CHAR_RIGHT = SnowflakeDialect.prototype.TICK_CHAR; module.exports = SnowflakeDialect;