Class AbstractDialect<Options, TConnectionOptions>Abstract

Type Parameters

  • Options extends object = object
  • TConnectionOptions extends object = object

Constructors

Properties

#baseDataTypes: Map<string, Class<ABSTRACT<any>>>

base implementations of shared data types

#dataTypeOverrides: Map<string, Class<ABSTRACT<any>>>

dialect-specific implementation of shared data types

#dataTypeParsers: Map<unknown, TypeParser> = ...
#printedWarnings: Set<string> = ...
Query: typeof AbstractQuery
[ConnectionOptionType]: TConnectionOptions
[OptionType]: Options
connectionManager: AbstractConnectionManager<any, any>
dataTypesDocumentationUrl: string
identifierDelimiter: {
    end: string;
    start: string;
}

Type declaration

  • Readonly end: string
  • Readonly start: string
minimumDatabaseVersion: string
name: "mysql" | "postgres" | "sqlite3" | "mariadb" | "mssql" | "db2" | "snowflake" | "ibmi"
options: Options
queryGenerator: AbstractQueryGenerator<AbstractDialect<object, object>>
queryInterface: AbstractQueryInterface<AbstractDialect<object, object>>
supports: DialectSupports = ...

List of features this dialect supports.

Important: Dialect implementations inherit these values. When changing a default, ensure the implementations still properly declare which feature they support.

Accessors

Methods

  • Produces a safe representation of a Buffer for this dialect, that can be inlined in a SQL string. Used mainly by DataTypes.

    Parameters

    • buffer: Buffer

      The buffer to escape

    Returns string

    The string, escaped for SQL.

  • Produces a safe representation of a string for this dialect, that can be inlined in a SQL string. Used mainly by DataTypes.

    Parameters

    • value: string

      The string to escape

    Returns string

    The string, escaped for SQL.

  • Returns the dialect-specific implementation of a shared data type, or null if no such implementation exists (in which case you need to use the base implementation).

    Parameters

    • dataType: Class<ABSTRACT<any>>

      The shared data type.

    Returns null | Class<ABSTRACT<any>>

  • Used to register a base parser for a Database type. Parsers are based on the Database Type, not the JS type. Only one parser can be assigned as the parser for a Database Type. For this reason, prefer neutral implementations.

    For instance, when implementing "parse" for a Date type, prefer returning a String rather than a Date object.

    The DataTypes.ABSTRACT#parseDatabaseValue method will then be called on the DataType instance defined by the user, which can decide on a more specific JS type (e.g. parse the date string & return a Date instance or a Temporal instance).

    You typically do not need to implement this method. This is used to provide default parsers when no DataType is provided (e.g. raw queries that don't specify a model). Sequelize already provides a default parser for most types. For a custom Data Type, implementing DataTypes.ABSTRACT#parseDatabaseValue is typically what you want.

    Parameters

    • databaseDataTypes: unknown[]

      Dialect-specific DB data type identifiers that will use this parser.

    • parser: TypeParser

      The parser function to call when parsing the data type. Parameters are dialect-specific.

    Returns void

  • Parameters

    • supportsOverwrite: {
          DEFAULT?: boolean;
          DEFAULT VALUES?: boolean;
          EXCEPTION?: boolean;
          IREGEXP?: boolean;
          LIMIT ON UPDATE?: boolean;
          ON DUPLICATE KEY?: boolean;
          ORDER NULLS?: boolean;
          REGEXP?: boolean;
          RIGHT JOIN?: boolean;
          UNION?: boolean;
          UNION ALL?: boolean;
          VALUES ()?: boolean;
          alterColumn?: {
              unique?: boolean;
          };
          autoIncrement?: {
              defaultValue?: boolean;
              identityInsert?: boolean;
              update?: boolean;
          };
          bulkDefault?: boolean;
          connectionTransactionMethods?: boolean;
          constraints?: {
              add?: boolean;
              check?: boolean;
              default?: boolean;
              deferrable?: boolean;
              foreignKey?: boolean;
              foreignKeyChecksDisableable?: boolean;
              onUpdate?: boolean;
              primaryKey?: boolean;
              remove?: boolean;
              removeOptions?: {
                  cascade?: boolean;
                  ifExists?: boolean;
              };
              restrict?: boolean;
              unique?: boolean;
          };
          createSchema?: {
              authorization?: boolean;
              charset?: boolean;
              collate?: boolean;
              comment?: boolean;
              ifNotExists?: boolean;
              replace?: boolean;
          };
          dataTypes?: {
              ARRAY?: boolean;
              BIGINT?: boolean;
              CHAR?: boolean;
              CIDR?: boolean;
              CITEXT?: boolean;
              COLLATE_BINARY?: boolean;
              DATEONLY?: {
                  infinity?: boolean;
              };
              DATETIME?: {
                  infinity?: boolean;
              };
              DECIMAL?: false | {
                  NaN?: boolean;
                  constrained?: boolean;
                  infinity?: boolean;
                  unconstrained?: boolean;
                  unsigned?: boolean;
                  zerofill?: boolean;
              };
              DOUBLE?: {
                  NaN?: boolean;
                  infinity?: boolean;
                  scaleAndPrecision?: boolean;
                  unsigned?: boolean;
                  zerofill?: boolean;
              };
              FLOAT?: {
                  NaN?: boolean;
                  infinity?: boolean;
                  scaleAndPrecision?: boolean;
                  unsigned?: boolean;
                  zerofill?: boolean;
              };
              GEOGRAPHY?: boolean;
              GEOMETRY?: boolean;
              HSTORE?: boolean;
              INET?: boolean;
              INTS?: {
                  unsigned?: boolean;
                  zerofill?: boolean;
              };
              JSON?: boolean;
              JSONB?: boolean;
              MACADDR?: boolean;
              MACADDR8?: boolean;
              RANGE?: boolean;
              REAL?: {
                  NaN?: boolean;
                  infinity?: boolean;
                  scaleAndPrecision?: boolean;
                  unsigned?: boolean;
                  zerofill?: boolean;
              };
              TIME?: {
                  precision?: boolean;
              };
              TSVECTOR?: boolean;
          };
          delete?: {
              limit?: boolean;
          };
          dropSchema?: {
              cascade?: boolean;
              ifExists?: boolean;
          };
          dropTable?: {
              cascade?: boolean;
          };
          escapeStringConstants?: boolean;
          finalTable?: boolean;
          forShare?: "LOCK IN SHARE MODE" | "FOR SHARE";
          globalTimeZoneConfig?: boolean;
          groupedLimit?: boolean;
          index?: {
              collate?: boolean;
              concurrently?: boolean;
              functionBased?: boolean;
              include?: boolean;
              length?: boolean;
              operator?: boolean;
              parser?: boolean;
              type?: boolean;
              using?: number | boolean;
              where?: boolean;
          };
          indexHints?: boolean;
          indexViaAlter?: boolean;
          inserts?: {
              conflictFields?: boolean;
              ignoreDuplicates?: string;
              onConflictDoNothing?: string;
              onConflictWhere?: boolean;
              updateOnDuplicate?: string | boolean;
          };
          isolationLevels?: boolean;
          jsonExtraction?: {
              quoted?: boolean;
              unquoted?: boolean;
          };
          jsonOperations?: boolean;
          lock?: boolean;
          lockKey?: boolean;
          lockOf?: boolean;
          lockOuterJoinFailure?: boolean;
          maxExecutionTimeHint?: {
              select?: boolean;
          };
          migrations?: boolean;
          multiDatabases?: boolean;
          removeColumn?: {
              cascade?: boolean;
              ifExists?: boolean;
          };
          renameTable?: {
              changeSchema?: boolean;
              changeSchemaAndTable?: boolean;
          };
          returnValues?: false | "output" | "returning";
          savepoints?: boolean;
          schemas?: boolean;
          searchPath?: boolean;
          settingIsolationLevelDuringTransaction?: boolean;
          skipLocked?: boolean;
          startTransaction?: {
              readOnly?: boolean;
              transactionType?: boolean;
              useBegin?: boolean;
          };
          tableHints?: boolean;
          tmpTableTrigger?: boolean;
          transactions?: boolean;
          truncate?: {
              cascade?: boolean;
              restartIdentity?: boolean;
          };
          upserts?: boolean;
          uuidV1Generation?: boolean;
          uuidV4Generation?: boolean;
      }
      • Optional DEFAULT?: boolean
      • Optional DEFAULT VALUES?: boolean
      • Optional EXCEPTION?: boolean
      • Optional IREGEXP?: boolean

        Case-insensitive regexp operator support ('~*' in postgres).

      • Optional LIMIT ON UPDATE?: boolean
      • Optional ON DUPLICATE KEY?: boolean
      • Optional ORDER NULLS?: boolean
      • Optional REGEXP?: boolean
      • Optional RIGHT JOIN?: boolean
      • Optional UNION?: boolean
      • Optional UNION ALL?: boolean
      • Optional VALUES ()?: boolean
      • Optional alterColumn?: {
            unique?: boolean;
        }
        • Optional unique?: boolean

          Can "ALTER TABLE x ALTER COLUMN y" add UNIQUE to the column in this dialect?

      • Optional autoIncrement?: {
            defaultValue?: boolean;
            identityInsert?: boolean;
            update?: boolean;
        }
        • Optional defaultValue?: boolean
        • Optional identityInsert?: boolean
        • Optional update?: boolean
      • Optional bulkDefault?: boolean
      • Optional connectionTransactionMethods?: boolean
      • Optional constraints?: {
            add?: boolean;
            check?: boolean;
            default?: boolean;
            deferrable?: boolean;
            foreignKey?: boolean;
            foreignKeyChecksDisableable?: boolean;
            onUpdate?: boolean;
            primaryKey?: boolean;
            remove?: boolean;
            removeOptions?: {
                cascade?: boolean;
                ifExists?: boolean;
            };
            restrict?: boolean;
            unique?: boolean;
        }
        • Optional add?: boolean
        • Optional check?: boolean
        • Optional default?: boolean
        • Optional deferrable?: boolean

          This dialect supports marking a column's constraints as deferrable. e.g. 'DEFERRABLE' and 'INITIALLY DEFERRED'

        • Optional foreignKey?: boolean
        • Optional foreignKeyChecksDisableable?: boolean

          Whether this dialect supports disabling foreign key checks for the current session

        • Optional onUpdate?: boolean
        • Optional primaryKey?: boolean
        • Optional remove?: boolean
        • Optional removeOptions?: {
              cascade?: boolean;
              ifExists?: boolean;
          }
          • Optional cascade?: boolean
          • Optional ifExists?: boolean
        • Optional restrict?: boolean
        • Optional unique?: boolean
      • Optional createSchema?: {
            authorization?: boolean;
            charset?: boolean;
            collate?: boolean;
            comment?: boolean;
            ifNotExists?: boolean;
            replace?: boolean;
        }
        • Optional authorization?: boolean
        • Optional charset?: boolean
        • Optional collate?: boolean
        • Optional comment?: boolean
        • Optional ifNotExists?: boolean
        • Optional replace?: boolean
      • Optional dataTypes?: {
            ARRAY?: boolean;
            BIGINT?: boolean;
            CHAR?: boolean;
            CIDR?: boolean;
            CITEXT?: boolean;
            COLLATE_BINARY?: boolean;
            DATEONLY?: {
                infinity?: boolean;
            };
            DATETIME?: {
                infinity?: boolean;
            };
            DECIMAL?: false | {
                NaN?: boolean;
                constrained?: boolean;
                infinity?: boolean;
                unconstrained?: boolean;
                unsigned?: boolean;
                zerofill?: boolean;
            };
            DOUBLE?: {
                NaN?: boolean;
                infinity?: boolean;
                scaleAndPrecision?: boolean;
                unsigned?: boolean;
                zerofill?: boolean;
            };
            FLOAT?: {
                NaN?: boolean;
                infinity?: boolean;
                scaleAndPrecision?: boolean;
                unsigned?: boolean;
                zerofill?: boolean;
            };
            GEOGRAPHY?: boolean;
            GEOMETRY?: boolean;
            HSTORE?: boolean;
            INET?: boolean;
            INTS?: {
                unsigned?: boolean;
                zerofill?: boolean;
            };
            JSON?: boolean;
            JSONB?: boolean;
            MACADDR?: boolean;
            MACADDR8?: boolean;
            RANGE?: boolean;
            REAL?: {
                NaN?: boolean;
                infinity?: boolean;
                scaleAndPrecision?: boolean;
                unsigned?: boolean;
                zerofill?: boolean;
            };
            TIME?: {
                precision?: boolean;
            };
            TSVECTOR?: boolean;
        }
        • Optional ARRAY?: boolean
        • Optional BIGINT?: boolean

          This dialect supports big integers

        • Optional CHAR?: boolean
        • Optional CIDR?: boolean
        • Optional CITEXT?: boolean

          This dialect supports case-insensitive text

        • Optional COLLATE_BINARY?: boolean

          Whether this dialect provides a binary collation on text, varchar & char columns.

        • Optional DATEONLY?: {
              infinity?: boolean;
          }
          • Optional infinity?: boolean

            Whether "infinity" is a valid value in this dialect's DATEONLY data type

        • Optional DATETIME?: {
              infinity?: boolean;
          }
          • Optional infinity?: boolean

            Whether "infinity" is a valid value in this dialect's DATETIME data type

        • Optional DECIMAL?: false | {
              NaN?: boolean;
              constrained?: boolean;
              infinity?: boolean;
              unconstrained?: boolean;
              unsigned?: boolean;
              zerofill?: boolean;
          }

          This dialect supports arbitrary precision numbers

        • Optional DOUBLE?: {
              NaN?: boolean;
              infinity?: boolean;
              scaleAndPrecision?: boolean;
              unsigned?: boolean;
              zerofill?: boolean;
          }

          This dialect supports 8 byte long floating point numbers

          • Optional NaN?: boolean

            Whether NaN can be inserted in a column that uses this DataType.

          • Optional infinity?: boolean

            Whether Infinity/-Infinity can be inserted in a column that uses this DataType.

          • Optional scaleAndPrecision?: boolean

            Whether scale & precision can be specified as parameters

          • Optional unsigned?: boolean

            Whether this dialect supports the unsigned option natively

          • Optional zerofill?: boolean
        • Optional FLOAT?: {
              NaN?: boolean;
              infinity?: boolean;
              scaleAndPrecision?: boolean;
              unsigned?: boolean;
              zerofill?: boolean;
          }

          This dialect supports 4 byte long floating point numbers

          • Optional NaN?: boolean

            Whether NaN can be inserted in a column that uses this DataType.

          • Optional infinity?: boolean

            Whether Infinity/-Infinity can be inserted in a column that uses this DataType.

          • Optional scaleAndPrecision?: boolean

            Whether scale & precision can be specified as parameters

          • Optional unsigned?: boolean

            Whether this dialect supports the unsigned option natively

          • Optional zerofill?: boolean
        • Optional GEOGRAPHY?: boolean
        • Optional GEOMETRY?: boolean
        • Optional HSTORE?: boolean
        • Optional INET?: boolean
        • Optional INTS?: {
              unsigned?: boolean;
              zerofill?: boolean;
          }

          Options supportable by all int types (from tinyint to bigint)

          • Optional unsigned?: boolean

            Whether this dialect supports the unsigned option natively

          • Optional zerofill?: boolean
        • Optional JSON?: boolean

          The dialect is considered to support JSON if it provides either:

          • A JSON data type.
          • An SQL function that can be used as a CHECK constraint on a text column, to ensure its contents are valid JSON.
        • Optional JSONB?: boolean
        • Optional MACADDR?: boolean
        • Optional MACADDR8?: boolean
        • Optional RANGE?: boolean
        • Optional REAL?: {
              NaN?: boolean;
              infinity?: boolean;
              scaleAndPrecision?: boolean;
              unsigned?: boolean;
              zerofill?: boolean;
          }

          Deprecated

          • Optional NaN?: boolean

            Whether NaN can be inserted in a column that uses this DataType.

          • Optional infinity?: boolean

            Whether Infinity/-Infinity can be inserted in a column that uses this DataType.

          • Optional scaleAndPrecision?: boolean

            Whether scale & precision can be specified as parameters

          • Optional unsigned?: boolean

            Whether this dialect supports the unsigned option natively

          • Optional zerofill?: boolean
        • Optional TIME?: {
              precision?: boolean;
          }
          • Optional precision?: boolean

            Whether the dialect supports TIME(precision)

        • Optional TSVECTOR?: boolean
      • Optional delete?: {
            limit?: boolean;
        }
        • Optional limit?: boolean
      • Optional dropSchema?: {
            cascade?: boolean;
            ifExists?: boolean;
        }
        • Optional cascade?: boolean
        • Optional ifExists?: boolean
      • Optional dropTable?: {
            cascade?: boolean;
        }
        • Optional cascade?: boolean
      • Optional escapeStringConstants?: boolean

        This dialect supports E-prefixed strings, e.g. "E'foo'", which enables the ability to use backslash escapes inside the string.

      • Optional finalTable?: boolean
      • Optional forShare?: "LOCK IN SHARE MODE" | "FOR SHARE"
      • Optional globalTimeZoneConfig?: boolean

        Whether this dialect supports changing the global timezone option

      • Optional groupedLimit?: boolean
      • Optional index?: {
            collate?: boolean;
            concurrently?: boolean;
            functionBased?: boolean;
            include?: boolean;
            length?: boolean;
            operator?: boolean;
            parser?: boolean;
            type?: boolean;
            using?: number | boolean;
            where?: boolean;
        }
        • Optional collate?: boolean
        • Optional concurrently?: boolean
        • Optional functionBased?: boolean
        • Optional include?: boolean
        • Optional length?: boolean
        • Optional operator?: boolean
        • Optional parser?: boolean
        • Optional type?: boolean
        • Optional using?: number | boolean
        • Optional where?: boolean
      • Optional indexHints?: boolean
      • Optional indexViaAlter?: boolean
      • Optional inserts?: {
            conflictFields?: boolean;
            ignoreDuplicates?: string;
            onConflictDoNothing?: string;
            onConflictWhere?: boolean;
            updateOnDuplicate?: string | boolean;
        }
        • Optional conflictFields?: boolean
        • Optional ignoreDuplicates?: string
        • Optional onConflictDoNothing?: string
        • Optional onConflictWhere?: boolean
        • Optional updateOnDuplicate?: string | boolean
      • Optional isolationLevels?: boolean
      • Optional jsonExtraction?: {
            quoted?: boolean;
            unquoted?: boolean;
        }

        Whether this dialect supports returning quoted & unquoted JSON strings

        • Optional quoted?: boolean
        • Optional unquoted?: boolean
      • Optional jsonOperations?: boolean

        Whether this dialect supports SQL JSON functions

      • Optional lock?: boolean
      • Optional lockKey?: boolean
      • Optional lockOf?: boolean
      • Optional lockOuterJoinFailure?: boolean
      • Optional maxExecutionTimeHint?: {
            select?: boolean;
        }
        • Optional select?: boolean
      • Optional migrations?: boolean
      • Optional multiDatabases?: boolean

        Whether this dialect has native support for having multiple databases per instance (in the postgres or mssql sense). For the purposes of Sequelize, a database is considered to be a grouping of schemas. For instance, in MySQL, "CREATE DATABASE" creates what we consider to be a schema, so we do not consider that MySQL supports this option.

      • Optional removeColumn?: {
            cascade?: boolean;
            ifExists?: boolean;
        }
        • Optional cascade?: boolean
        • Optional ifExists?: boolean
      • Optional renameTable?: {
            changeSchema?: boolean;
            changeSchemaAndTable?: boolean;
        }
        • Optional changeSchema?: boolean
        • Optional changeSchemaAndTable?: boolean
      • Optional returnValues?: false | "output" | "returning"
      • Optional savepoints?: boolean
      • Optional schemas?: boolean

        Whether this dialect has native support for schemas. For the purposes of Sequelize, a Schema is considered to be a grouping of tables. For instance, in MySQL, "CREATE DATABASE" creates what we consider to be a schema.

      • Optional searchPath?: boolean
      • Optional settingIsolationLevelDuringTransaction?: boolean
      • Optional skipLocked?: boolean
      • Optional startTransaction?: {
            readOnly?: boolean;
            transactionType?: boolean;
            useBegin?: boolean;
        }
        • Optional readOnly?: boolean
        • Optional transactionType?: boolean
        • Optional useBegin?: boolean
      • Optional tableHints?: boolean
      • Optional tmpTableTrigger?: boolean
      • Optional transactions?: boolean
      • Optional truncate?: {
            cascade?: boolean;
            restartIdentity?: boolean;
        }
        • Optional cascade?: boolean
        • Optional restartIdentity?: boolean
      • Optional upserts?: boolean
      • Optional uuidV1Generation?: boolean

        Whether this dialect provides a native way to generate UUID v1 values

      • Optional uuidV4Generation?: boolean

        Whether this dialect provides a native way to generate UUID v4 values

    Returns DialectSupports