Class AbstractDialect<Options, TConnectionOptions>Abstract

Type Parameters

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

Constructors

Properties

"[ConnectionOptionType]": TConnectionOptions
"[OptionType]": Options
connectionManager: AbstractConnectionManager<any, any>
dataTypesDocumentationUrl: string
identifierDelimiter: { end: string; start: string }
minimumDatabaseVersion: string
name:
    | "mysql"
    | "postgres"
    | "sqlite3"
    | "mariadb"
    | "mssql"
    | "db2"
    | "snowflake"
    | "ibmi"
options: Options
Query: typeof AbstractQuery
queryGenerator: AbstractQueryGenerator
queryInterface: AbstractQueryInterface
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: {
          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
                  | {
                      constrained?: boolean;
                      infinity?: boolean;
                      NaN?: boolean;
                      unconstrained?: boolean;
                      unsigned?: boolean;
                      zerofill?: boolean;
                  };
              DOUBLE?: {
                  infinity?: boolean;
                  NaN?: boolean;
                  scaleAndPrecision?: boolean;
                  unsigned?: boolean;
                  zerofill?: boolean;
              };
              FLOAT?: {
                  infinity?: boolean;
                  NaN?: 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?: {
                  infinity?: boolean;
                  NaN?: boolean;
                  scaleAndPrecision?: boolean;
                  unsigned?: boolean;
                  zerofill?: boolean;
              };
              TIME?: { precision?: boolean };
              TSVECTOR?: boolean;
          };
          DEFAULT?: boolean;
          "DEFAULT VALUES"?: boolean;
          delete?: { limit?: boolean };
          dropSchema?: { cascade?: boolean; ifExists?: boolean };
          dropTable?: { cascade?: boolean };
          escapeStringConstants?: boolean;
          EXCEPTION?: 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;
          };
          IREGEXP?: boolean;
          isolationLevels?: boolean;
          jsonExtraction?: { quoted?: boolean; unquoted?: boolean };
          jsonOperations?: boolean;
          "LIMIT ON UPDATE"?: boolean;
          lock?: boolean;
          lockKey?: boolean;
          lockOf?: boolean;
          lockOuterJoinFailure?: boolean;
          maxExecutionTimeHint?: { select?: boolean };
          migrations?: boolean;
          multiDatabases?: boolean;
          "ON DUPLICATE KEY"?: boolean;
          "ORDER NULLS"?: boolean;
          REGEXP?: boolean;
          removeColumn?: { cascade?: boolean; ifExists?: boolean };
          renameTable?: { changeSchema?: boolean; changeSchemaAndTable?: boolean };
          returnValues?: false | "output" | "returning";
          "RIGHT JOIN"?: boolean;
          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 };
          UNION?: boolean;
          "UNION ALL"?: boolean;
          upserts?: boolean;
          uuidV1Generation?: boolean;
          uuidV4Generation?: boolean;
          "VALUES ()"?: boolean;
      }
      • OptionalalterColumn?: { unique?: boolean }
        • Optionalunique?: boolean

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

      • OptionalautoIncrement?: { defaultValue?: boolean; identityInsert?: boolean; update?: boolean }
      • OptionalbulkDefault?: boolean
      • OptionalconnectionTransactionMethods?: boolean
      • Optionalconstraints?: {
            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;
        }
        • Optionaladd?: boolean
        • Optionalcheck?: boolean
        • Optionaldefault?: boolean
        • Optionaldeferrable?: boolean

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

        • OptionalforeignKey?: boolean
        • OptionalforeignKeyChecksDisableable?: boolean

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

        • OptionalonUpdate?: boolean
        • OptionalprimaryKey?: boolean
        • Optionalremove?: boolean
        • OptionalremoveOptions?: { cascade?: boolean; ifExists?: boolean }
        • Optionalrestrict?: boolean
        • Optionalunique?: boolean
      • OptionalcreateSchema?: {
            authorization?: boolean;
            charset?: boolean;
            collate?: boolean;
            comment?: boolean;
            ifNotExists?: boolean;
            replace?: boolean;
        }
      • OptionaldataTypes?: {
            ARRAY?: boolean;
            BIGINT?: boolean;
            CHAR?: boolean;
            CIDR?: boolean;
            CITEXT?: boolean;
            COLLATE_BINARY?: boolean;
            DATEONLY?: { infinity?: boolean };
            DATETIME?: { infinity?: boolean };
            DECIMAL?:
                | false
                | {
                    constrained?: boolean;
                    infinity?: boolean;
                    NaN?: boolean;
                    unconstrained?: boolean;
                    unsigned?: boolean;
                    zerofill?: boolean;
                };
            DOUBLE?: {
                infinity?: boolean;
                NaN?: boolean;
                scaleAndPrecision?: boolean;
                unsigned?: boolean;
                zerofill?: boolean;
            };
            FLOAT?: {
                infinity?: boolean;
                NaN?: 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?: {
                infinity?: boolean;
                NaN?: boolean;
                scaleAndPrecision?: boolean;
                unsigned?: boolean;
                zerofill?: boolean;
            };
            TIME?: { precision?: boolean };
            TSVECTOR?: boolean;
        }
        • OptionalARRAY?: boolean
        • OptionalBIGINT?: boolean

          This dialect supports big integers

        • OptionalCHAR?: boolean
        • OptionalCIDR?: boolean
        • OptionalCITEXT?: boolean

          This dialect supports case-insensitive text

        • OptionalCOLLATE_BINARY?: boolean

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

        • OptionalDATEONLY?: { infinity?: boolean }
          • Optionalinfinity?: boolean

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

        • OptionalDATETIME?: { infinity?: boolean }
          • Optionalinfinity?: boolean

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

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

          This dialect supports arbitrary precision numbers

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

          This dialect supports 8 byte long floating point numbers

          • Optionalinfinity?: boolean

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

          • OptionalNaN?: boolean

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

          • OptionalscaleAndPrecision?: boolean

            Whether scale & precision can be specified as parameters

          • Optionalunsigned?: boolean

            Whether this dialect supports the unsigned option natively

          • Optionalzerofill?: boolean
        • OptionalFLOAT?: {
              infinity?: boolean;
              NaN?: boolean;
              scaleAndPrecision?: boolean;
              unsigned?: boolean;
              zerofill?: boolean;
          }

          This dialect supports 4 byte long floating point numbers

          • Optionalinfinity?: boolean

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

          • OptionalNaN?: boolean

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

          • OptionalscaleAndPrecision?: boolean

            Whether scale & precision can be specified as parameters

          • Optionalunsigned?: boolean

            Whether this dialect supports the unsigned option natively

          • Optionalzerofill?: boolean
        • OptionalGEOGRAPHY?: boolean
        • OptionalGEOMETRY?: boolean
        • OptionalHSTORE?: boolean
        • OptionalINET?: boolean
        • OptionalINTS?: { unsigned?: boolean; zerofill?: boolean }

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

          • Optionalunsigned?: boolean

            Whether this dialect supports the unsigned option natively

          • Optionalzerofill?: boolean
        • OptionalJSON?: 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.
        • OptionalJSONB?: boolean
        • OptionalMACADDR?: boolean
        • OptionalMACADDR8?: boolean
        • OptionalRANGE?: boolean
        • OptionalREAL?: {
              infinity?: boolean;
              NaN?: boolean;
              scaleAndPrecision?: boolean;
              unsigned?: boolean;
              zerofill?: boolean;
          }
          • Optionalinfinity?: boolean

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

          • OptionalNaN?: boolean

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

          • OptionalscaleAndPrecision?: boolean

            Whether scale & precision can be specified as parameters

          • Optionalunsigned?: boolean

            Whether this dialect supports the unsigned option natively

          • Optionalzerofill?: boolean
        • OptionalTIME?: { precision?: boolean }
          • Optionalprecision?: boolean

            Whether the dialect supports TIME(precision)

        • OptionalTSVECTOR?: boolean
      • OptionalDEFAULT?: boolean
      • OptionalDEFAULT VALUES?: boolean
      • Optionaldelete?: { limit?: boolean }
      • OptionaldropSchema?: { cascade?: boolean; ifExists?: boolean }
      • OptionaldropTable?: { cascade?: boolean }
      • OptionalescapeStringConstants?: boolean

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

      • OptionalEXCEPTION?: boolean
      • OptionalfinalTable?: boolean
      • OptionalforShare?: "LOCK IN SHARE MODE" | "FOR SHARE"
      • OptionalglobalTimeZoneConfig?: boolean

        Whether this dialect supports changing the global timezone option

      • OptionalgroupedLimit?: boolean
      • Optionalindex?: {
            collate?: boolean;
            concurrently?: boolean;
            functionBased?: boolean;
            include?: boolean;
            length?: boolean;
            operator?: boolean;
            parser?: boolean;
            type?: boolean;
            using?: number | boolean;
            where?: boolean;
        }
      • OptionalindexHints?: boolean
      • OptionalindexViaAlter?: boolean
      • Optionalinserts?: {
            conflictFields?: boolean;
            ignoreDuplicates?: string;
            onConflictDoNothing?: string;
            onConflictWhere?: boolean;
            updateOnDuplicate?: string | boolean;
        }
      • OptionalIREGEXP?: boolean

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

      • OptionalisolationLevels?: boolean
      • OptionaljsonExtraction?: { quoted?: boolean; unquoted?: boolean }

        Whether this dialect supports returning quoted & unquoted JSON strings

      • OptionaljsonOperations?: boolean

        Whether this dialect supports SQL JSON functions

      • OptionalLIMIT ON UPDATE?: boolean
      • Optionallock?: boolean
      • OptionallockKey?: boolean
      • OptionallockOf?: boolean
      • OptionallockOuterJoinFailure?: boolean
      • OptionalmaxExecutionTimeHint?: { select?: boolean }
      • Optionalmigrations?: boolean
      • OptionalmultiDatabases?: 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.

      • OptionalON DUPLICATE KEY?: boolean
      • OptionalORDER NULLS?: boolean
      • OptionalREGEXP?: boolean
      • OptionalremoveColumn?: { cascade?: boolean; ifExists?: boolean }
      • OptionalrenameTable?: { changeSchema?: boolean; changeSchemaAndTable?: boolean }
      • OptionalreturnValues?: false | "output" | "returning"
      • OptionalRIGHT JOIN?: boolean
      • Optionalsavepoints?: boolean
      • Optionalschemas?: 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.

      • OptionalsearchPath?: boolean
      • OptionalsettingIsolationLevelDuringTransaction?: boolean
      • OptionalskipLocked?: boolean
      • OptionalstartTransaction?: { readOnly?: boolean; transactionType?: boolean; useBegin?: boolean }
      • OptionaltableHints?: boolean
      • OptionaltmpTableTrigger?: boolean
      • Optionaltransactions?: boolean
      • Optionaltruncate?: { cascade?: boolean; restartIdentity?: boolean }
      • OptionalUNION?: boolean
      • OptionalUNION ALL?: boolean
      • Optionalupserts?: boolean
      • OptionaluuidV1Generation?: boolean

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

      • OptionaluuidV4Generation?: boolean

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

      • OptionalVALUES ()?: boolean

    Returns DialectSupports