Documentation
    Preparing search index...

    Class MySqlDialect

    Hierarchy (View Summary)

    Index
    "[ConnectionOptionType]": MySqlConnectionOptions
    "[OptionType]": MySqlDialectOptions
    connectionManager: MySqlConnectionManager
    dataTypesDocumentationUrl: string
    identifierDelimiter: { end: string; start: string }
    minimumDatabaseVersion: string
    name: string
    Query: typeof MySqlQuery = MySqlQuery
    queryGenerator: MySqlQueryGenerator
    queryInterface: MySqlQueryInterface
    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.

    • get defaultVersion(): string

      Returns string

      use minimumDatabaseVersion

    • get supports(): DialectSupports

      Returns DialectSupports

    • get TICK_CHAR_LEFT(): string

      Returns string

      use identifierDelimiter.start

    • get TICK_CHAR_RIGHT(): string

      Returns string

      use identifierDelimiter.end

    • 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 readonly string[]

    • 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

      • text: string

      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; concurrentDropConstraints?: 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
                | false;
                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 };
            maxTableAliasLength?: number;
            migrations?: boolean;
            multiDatabases?: boolean;
            "ON DUPLICATE KEY"?: boolean;
            "ORDER NULLS"?: boolean;
            randomFloatGeneration?: boolean;
            REGEXP?: boolean;
            removeColumn?: { cascade?: boolean; ifExists?: boolean };
            renameTable?: { changeSchema?: boolean; changeSchemaAndTable?: boolean };
            returnIntoValues?: boolean;
            returnValues?: false | "output" | "returning";
            "RIGHT JOIN"?: boolean;
            savepoints?: boolean;
            schemas?: boolean;
            searchPath?: boolean;
            select?: { dummyTable?: string | null };
            settingIsolationLevelDuringTransaction?: boolean;
            skipLocked?: boolean;
            startTransaction?: {
                readOnly?: boolean;
                transactionType?: boolean;
                useBegin?: boolean;
            };
            tableHints?: boolean;
            tmpTableTrigger?: boolean;
            topLevelOrderByRequired?: boolean;
            transactions?: boolean;
            truncate?: { cascade?: boolean; restartIdentity?: boolean };
            UNION?: boolean;
            "UNION ALL"?: boolean;
            upserts?: boolean;
            uuidV1Generation?: boolean;
            uuidV4Generation?: boolean;
            uuidV7Generation?: 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 }

          features specific to autoIncrement values

          • OptionaldefaultValue?: boolean

            does the dialect support inserting default/null values for autoincrement fields

          • OptionalidentityInsert?: boolean

            does the dialect require modification of insert queries when inserting auto increment fields

          • Optionalupdate?: boolean

            does the dialect support updating autoincrement fields

        • OptionalbulkDefault?: boolean

          Do we need to say DEFAULT for bulk insert

        • 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; concurrentDropConstraints?: 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 | false;
              onConflictDoNothing?: string;
              onConflictWhere?: boolean;
              updateOnDuplicate?: string | boolean;
          }
          • OptionalconflictFields?: boolean

            whether the dialect supports specifying conflict fields or not

          • OptionalignoreDuplicates?: string | false
          • OptionalonConflictDoNothing?: string

            dialect specific words for ON CONFLICT DO NOTHING

          • OptionalonConflictWhere?: boolean

            whether dialect supports ON CONFLICT WHERE

          • OptionalupdateOnDuplicate?: string | boolean

            whether dialect supports ON DUPLICATE KEY UPDATE

        • 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 }
        • OptionalmaxTableAliasLength?: number
        • 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
        • OptionalrandomFloatGeneration?: boolean

          Whether this dialect provides a native way to generate random values between 0 and 1

        • OptionalREGEXP?: boolean
        • OptionalremoveColumn?: { cascade?: boolean; ifExists?: boolean }
        • OptionalrenameTable?: { changeSchema?: boolean; changeSchemaAndTable?: boolean }
        • OptionalreturnIntoValues?: boolean

          does the dialect support returning values for inserted/updated fields in outBinds

        • OptionalreturnValues?: false | "output" | "returning"

          does the dialect support returning values for inserted/updated fields

        • 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
        • Optionalselect?: { dummyTable?: string | null }
          • OptionaldummyTable?: string | null

            The dummy table to use when we do not care about the source of the data, e.g. when selecting the result of a function or a literal value.

            If null, not specifying the FROM clause is supported. If a string, the name of the dummy table to use, e.g. DUAL (Oracle) or SYSIBM.SYSDUMMY1 (IBMi).

        • OptionalsettingIsolationLevelDuringTransaction?: boolean
        • OptionalskipLocked?: boolean
        • OptionalstartTransaction?: { readOnly?: boolean; transactionType?: boolean; useBegin?: boolean }
        • OptionaltableHints?: boolean
        • OptionaltmpTableTrigger?: boolean
        • OptionaltopLevelOrderByRequired?: boolean

          does the dialect support topLevelOrderBy (ORDER BY clause) to get desired results

        • 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

        • OptionaluuidV7Generation?: boolean

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

        • OptionalVALUES ()?: boolean

      Returns DialectSupports